Products & Services Solutions Academia Support User Community Company

Learn more about Communications Toolbox   

rsgenpoly - Generator polynomial of Reed-Solomon code

Syntax

genpoly = rsgenpoly(n,k)
genpoly = rsgenpoly(n,k,prim_poly)
genpoly = rsgenpoly(n,k,prim_poly,b)
[genpoly,t] = rsgenpoly(...)

Description

genpoly = rsgenpoly(n,k) returns the narrow-sense generator polynomial of a Reed-Solomon code with codeword length n and message length k. The codeword length n must have the form 2m-1 for some integer m, and n-k must be an even integer. The output genpoly is a Galois row vector that represents the coefficients of the generator polynomial in order of descending powers. The narrow-sense generator polynomial is (X - A1)(X - A2)...(X - A2t) where A is a root of the default primitive polynomial for the field GF(n+1) and t is the code's error-correction capability, (n-k)/2.

genpoly = rsgenpoly(n,k,prim_poly) is the same as the syntax above, except that prim_poly specifies the primitive polynomial for GF(n+1) that has A as a root. prim_poly is an integer whose binary representation indicates the coefficients of the primitive polynomial. To use the default primitive polynomial GF(n+1), set prim_poly to [].

genpoly = rsgenpoly(n,k,prim_poly,b) returns the generator polynomial (X - Ab)(X - Ab+1)...(X - Ab+2t-1), where b is an integer, A is a root of prim_poly, and t is the code's error-correction capability, (n-k)/2.

[genpoly,t] = rsgenpoly(...) returns t, the error-correction capability of the code.

Examples

The examples below create Galois row vectors that represent generator polynomials for a [7,3] Reed-Solomon code. The vectors g and g2 both represent the narrow-sense generator polynomial, but with respect to different primitive elements A. More specifically, g2 is defined such that A is a root of the primitive polynomial D3 + D2 + 1 for GF(8), not of the default primitive polynomial D3 + D + 1. The vector g3 represents the generator polynomial (X - A3)(X - A4)(X - A5)(X - A6), where A is a root of D3 + D2 + 1 in GF(8).

g = rsgenpoly(7,3)
g2 = rsgenpoly(7,3,13) % Use nondefault primitive polynomial.
g3 = rsgenpoly(7,3,13,3) % Use b = 3.

The output is below.

g = GF(2^3) array. Primitive polynomial = D^3+D+1 (11 decimal)
 
Array elements = 
 
     1     3     1     2     3

 
g2 = GF(2^3) array. Primitive polynomial = D^3+D^2+1 (13 decimal)
 
Array elements = 
 
     1     4     5     1     5

 
g3 = GF(2^3) array. Primitive polynomial = D^3+D^2+1 (13 decimal)
 
Array elements = 
 
     1     7     1     6     7

As another example, the command below shows that the default narrow-sense generator polynomial for a [15,11] Reed-Solomon code is X4 + (A3 + A2 + 1)X3 + (A3 + A2)X2 + A3X + (A2 + A + 1), where A is a root of the default primitive polynomial for GF(16).

gp = rsgenpoly(15,11)
gp = GF(2^4) array. Primitive polynomial = D^4+D+1 (19 decimal)
 
Array elements = 
 
     1    13    12     8     7

For additional examples, see Parameters for Reed-Solomon Codes.

Limitations

n and k must differ by an even integer. The maximum allowable value of n is 65535.

See Also

gf, rsenc, rsdec, Block Coding

  


Free Early Verification Kit

Learn how to apply early verification to your development process through these technical resources.

How much time do you spend on testing to ensure implementation meets system-level requirements?

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS