Main Content

bchgenpoly

Produce generator polynomials for BCH code

Description

genpoly = bchgenpoly(N,K) returns the narrow-sense generator polynomial of a BCH code with codeword length N and message length K. For more information, see Generator Polynomial of a BCH Code.

example

genpoly = bchgenpoly(N,K,prim_poly) also specifies the primitive polynomial.

example

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

example

[genpoly,T] = bchgenpoly(___) also returns T, the error-correction capability of the code when using any of the previous syntaxes.

example

Examples

collapse all

Create two BCH generator polynomials based on different primitive polynomials.

Set the codeword and message lengths, n and k.

n = 15;
k = 11;

Create the generator polynomial and return the error correction capability, t.

[genpoly,t] = bchgenpoly(15,11)
 
genpoly = GF(2) array. 
 
Array elements = 
 
   1   0   0   1   1
t = 
1

Create a generator polynomial for a (15,11) BCH code using a different primitive polynomial expressed as a character vector. Note that genpoly2 differs from genpoly, which uses the default primitive.

genpoly2 = bchgenpoly(15,11,'D^4 + D^3 + 1')
 
genpoly2 = GF(2) array. 
 
Array elements = 
 
   1   1   0   0   1

Input Arguments

collapse all

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

Example: 15 for M=4

Message length, specified as an integer. N and K must produce a narrow-sense BCH code. To generate the list of valid (N,K) pairs along with the corresponding values of the error-correction capability, run bchnumerr(N). For more information, see Limitations.

Example: 5 specifies a Galois array with five elements

Primitive polynomial, specified as:

Example: 'D^4+D+1' specifies the primitive polynomial D4+D+1.

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

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, returned as a row vector that represents the coefficients of the narrow-sense generator polynomial of an [N,K] BCH code in order of descending powers. Specify the output datatype with the outputFormat property.

Data Types: gf | double

Error correction capability, returned as a positive integer.

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)].

Algorithms

collapse all

For a description of Bose–Chaudhuri–Hocquenghem (BCH) coding, see [1]. Although bchgenpoly performs intermediate computations in GF(N + 1), the output form is a Galois vector in GF(2).

References

[1] Peterson, W. Wesley, and E. J. Weldon. Error-Correcting Codes. 2d ed. MIT Press, 1972.

Version History

Introduced before R2006a