This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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 = rsgenpoly(N,K,prim_poly,B,outputFormat)
[genpoly,T] = rsgenpoly(___)

Description

example

genpoly = rsgenpoly(N,K) returns the narrow-sense generator polynomial of an [N,K] Reed-Solomon code. The output genpoly is a Galois field array that represents the coefficients of the generator polynomial in order of descending powers. The narrow-sense generator polynomial is (X – α1)(X – α2)...(X – αNK), where α is a root of the default primitive polynomial for the field GF(N+1). For additional information, see Narrow-Sense BCH Codes and Reed-Solomon Codes.

example

genpoly = rsgenpoly(N,K,prim_poly) also specifies the primitive polynomial, prim_poly, for GF(N+1) that has α as a root.

example

genpoly = rsgenpoly(N,K,prim_poly,B) returns the generator polynomial, (X – αB)(X – αB+1)...(X – αB+NK – 1), where B is an integer.

example

genpoly = rsgenpoly(N,K,prim_poly,B,outputFormat) specifies the output format of genpoly as a Galois field array or double-precision array.

example

[genpoly,T] = rsgenpoly(___) also returns the error-correction capability of the [N,K] Reed-Solomon code,T, using any of the preceding input argument syntaxes.

Examples

collapse all

Specify the codeword length, n, and message length, k.

n = 7;
k = 3;

Create the narrow-sense generator polynomial for the [n,k] Reed-Solomon code. genpoly is a Galois field array, by default, that represents the coefficients of this generator polynomial in order of descending powers.

genpoly = rsgenpoly(n,k)
 
genpoly = GF(2^3) array. Primitive polynomial = D^3+D+1 (11 decimal)
 
Array elements = 
 
   1   3   1   2   3

Create the narrow-sense generator polynomial of a Reed-Solomon code with respect to the primitive polynomial D3+D2+1.

Specify the codeword length, n, message length, k, and primitive polynomial D3+D2+1 represented in decimal form.

n = 7;
k = 3;
prim_poly = 13;

Create the narrow-sense generator polynomial for the [n,k] Reed-Solomon code with respect to primitive polynomial D3+D2+1 for GF(8). genpoly is a Galois field array, by default, that represent the coefficients of this generator polynomial in order of descending powers.

genpoly = rsgenpoly(n,k,prim_poly)
 
genpoly = GF(2^3) array. Primitive polynomial = D^3+D^2+1 (13 decimal)
 
Array elements = 
 
   1   4   5   1   5

Create the narrow-sense generator polynomial of a Reed-Solomon code with respect to the default primitive polynomial.

Specify the codeword length, n, message length, k, and exponent of α, b.

n = 7;
k = 3;
b = 4;

Create the narrow-sense generator polynomial (X-α4)(X-α5)(X-α6)(X-α7), with respect to the default primitive polynomial. genpoly is a Galois field array, by default, that represents the coefficients of this generator polynomial in order of descending powers. Display the error-correcting capability of the code.

[genpoly,t] = rsgenpoly(n,k,[],b)
 
genpoly = GF(2^3) array. Primitive polynomial = D^3+D+1 (11 decimal)
 
Array elements = 
 
   1   5   5   3   2
t = 2

Create the narrow-sense generator polynomial of a Reed-Solomon code with respect to the primitive polynomial D8+D4+D3+D2+1.

Specify the codeword length, n, message length, k, the primitive polynomial represented in decimal form, and the exponent of α, b.

n = 255;
k = 239;
prim_poly = 285;
b = 0;

Create the narrow-sense generator polynomial for the [n,k] Reed-Solomon code. genpoly is a Galois field array, by default, that represents a generator polynomial and is compliant with DVB-S and WiMAX.

genpoly = rsgenpoly(n,k,prim_poly,b)
 
genpoly = GF(2^8) array. Primitive polynomial = D^8+D^4+D^3+D^2+1 (285 decimal)
 
Array elements = 
 
  Columns 1 through 13

     1    59    13   104   189    68   209    30     8   163    65    41   229

  Columns 14 through 17

    98    50    36    59

Create the narrow-sense generator polynomial of a Reed-Solomon code. Specify the output data type as a double-precision array.

Specify the codeword length, n, and message length, k.

n = 7;
k = 3;

Create the narrow-sense generator polynomial for the [n,k] Reed-Solomon code. genpoly is a double-precision array, that represents the coefficients of this generator polynomial in order of descending powers. Specify defaults values for the primitive polynomial and exponent of α inputs by assigning [ ] for them.

genpoly = rsgenpoly(n,k,[],[],'double')
genpoly = 1×5

     1     3     1     2     3

Input Arguments

collapse all

Codeword length, specified as an integer of the form N = 2M – 1, where M is in the range [3,16]. For more information, see Limitations.

Example: Set N to 15 for M=4.

Message length, specified as a positive integer. For more information, see Limitations.

Primitive polynomial, specified as a positive integer. 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 []. For more information, see Default Primitive Polynomials.

Example: 19 specifies the primitive polynomial D4+D+1 because its binary representation is 10011.

Exponent of α, specified as a positive integer. α is a root of prim_poly.

Output format of genpoly, specified as:

  • 'gf' — to output a Galois field array.

  • 'double' — to output a double-precision array of the Galois field values.

For more information, see Working with Galois Fields.

Output Arguments

collapse all

Generator polynomial coefficients in descending order, returned as a Galois field array or double-precision array. genpoly is a row vector that represents the coefficients of the narrow-sense generator polynomial of an [N,K] Reed-Solomon code in order of descending powers.

Error-correction capability of the code, returned as a positive integer equal to ⌊(NK)/2⌋.

Limitations

  • Valid values for N = 2M – 1, where M is an integer in the range [3,16]. The maximum allowable value of N = 216 – 1 = 65,535.

  • Valid values for K = [1,N – 1].

More About

collapse all

Default Primitive Polynomials

This table lists the default primitive polynomial used for each Galois field array GF(2M). To use a different primitive polynomial, specify prim_poly as an input argument. prim_poly must be in the range [(2M+1), (2(M+1)-1)] and must indicate an irreducible polynomial. For more information, see Specifying the Primitive Polynomial.

MDefault Primitive PolynomialInteger Representation
1D + 13
2D^2 + D + 17
3D^3 + D + 111
4D^4 + D + 119
5D^5 + D^2 + 137
6D^6 + D + 167
7D^7 + D^3 + 1137
8D^8 + D^4 + D^3 + D^2 + 1285
9D^9 + D^4 + 1529
10D^10 + D^3 + 11033
11D^11 + D^2 + 12053
12D^12 + D^6 + D^4 + D + 14179
13D^13 + D^4 + D^3 + D + 18219
14D^14 + D^10 + D^6 + D + 117475
15D^15 + D + 132771
16D^16 + D^12 + D^3 + D + 169643

Extended Capabilities

Introduced before R2006a