Generator polynomial of BCH code
genpoly = bchgenpoly(n,k)
genpoly = bchgenpoly(n,k,prim_poly)
genpoly = bchgenpoly(n,k,prim_poly,outputFormat)
[genpoly,t] = bchgenpoly(...)
genpoly = bchgenpoly(n,k) returns
the narrow-sense generator polynomial of a BCH code with codeword
n and message length
The codeword length
n must have the form 2m-1
for some integer m between 3 and 16. The output
a Galois row vector that represents the coefficients of the generator
polynomial in order of descending powers. The narrow-sense generator
polynomial is LCM[m_1(x), m_2(x), ..., m_2t(x)], where:
LCM represents the least common multiple,
m_i(x) represents the minimum polynomial corresponding to αi, α is a root of the default primitive polynomial for the field GF(
and t represents the error-correcting capability of the code.
bchgenpoly function performs
intermediate computations in GF(
n+1), the final
polynomial has binary coefficients. The output from
a Galois vector in GF(2) rather than in GF(
genpoly = bchgenpoly(n,k,prim_poly) is
the same as the syntax above, except that
the primitive polynomial for GF(
n+1) that has Alpha
as a root.
prim_poly is either a polynomial
character vector or an integer whose binary representation
indicates the coefficients of the primitive polynomial in order of
descending powers. To use the default primitive polynomial for GF(
genpoly = bchgenpoly(n,k,prim_poly,outputFormat) is
the same as the previous syntax, except that
output data type. The value of
gf' or '
to Galois field and double data types respectively. The default value
outputFormat is '
[genpoly,t] = bchgenpoly(...) returns
the error-correction capability of the code.
Create a BCH Generator Polynomial
Create two BCH generator polynomials based on different primitive polynomials.
Set the codeword and message lengths,
n = 15; k = 11;
Create the generator polynomial and return the error correction capability,
[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
The maximum allowable value of
n is 65535.
 Peterson, W. Wesley, and E. J. Weldon, Jr., Error-Correcting Codes, 2nd ed., Cambridge, MA, MIT Press, 1972.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
All inputs must be constants. Expressions or variables are allowed if their values do not change.