This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Generator polynomial of Reed-Solomon code


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


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 between 3 and 16.

, 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 - Alpha1)(X - Alpha2)...(X - Alpha2t) where:

  • Alpha represents a root of the default primitive polynomial for the field GF(n+1),

  • and t represents 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 Alpha 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 - Alphab)(X - Alphab+1)...(X - Alphab+2t-1), where:

  • b is an integer,

  • Alpha 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.


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.


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

Extended Capabilities

See Also

| |


Introduced before R2006a

Was this topic helpful?