Main Content

cyclpoly

Produce generator polynomials for binary cyclic code

Description

pol = cyclpoly(N,K) returns the row vector representing one nontrivial generator polynomial for a cyclic code with codeword length N and message length K.

example

pol = cyclpoly(N,K,opt) searches for one or more nontrivial generator polynomials for cyclic codes with codeword length N and message length K. The output pol depends on the value of opt, which specifies the weight of the polynomial.

Examples

collapse all

Create [15,4] cyclic code generator polynomials.

Use the input 'all' to show all possible generator polynomials for a [15,4] cyclic code. Use the input 'max' to show that 1+x+x2+x3+x5+x7+x8+x11 is one such polynomial that has the largest number of nonzero terms.

c1 = cyclpoly(15,4,'all')
c1 = 3×12

     1     1     0     0     0     1     1     0     0     0     1     1
     1     0     0     1     1     0     1     0     1     1     1     1
     1     1     1     1     0     1     0     1     1     0     0     1

c2 = cyclpoly(15,4,'max')
c2 = 1×12

     1     1     1     1     0     1     0     1     1     0     0     1

This command shows that no generator polynomial for a [15,4] cyclic code has exactly three nonzero terms.

c3 = cyclpoly(15,4,3)
Warning: No cyclic generator polynomial satisfies the given constraints.
c3 =

     []

Input Arguments

collapse all

Codeword length, specified as a positive integer.

Message length, specified as a positive integer.

Weight option, specified as:

  • 'min' — one generator polynomial with the smallest possible weight

  • 'max' — one generator polynomial with the greatest possible weight

  • 'all' — all generator polynomials

  • Positive Integer — all generator polynomials with this weight

Output Arguments

collapse all

Generator polynomial coefficients, returned as a row vector or matrix containing binary values that indicate the coefficients of generator polynomials in order of ascending powers. When the output is a matrix, each row represents an individual polynomial.

Data Types: double

More About

collapse all

Generator Polynomials

Generator polynomials are parameters that are required in order to process [N,K] cyclic block codes. Cyclic codes have algebraic properties that allow a polynomial to determine the coding process completely. The generator polynomial is a degree-(NK) divisor of the polynomial xN – 1. For more information, see Configure Parameters for Linear Block Codes.

Algorithms

Generator polynomials are found by looping through degree-(NK) polynomials and finding those that are divisors of the polynomial xN – 1. If opt is omitted, cyclpoly returns the first polynomial it finds that satisfies this condition. If opt is 'min' or 'max', cyclpoly returns the generator polynomial with either the smallest or greatest possible weight respectively. If opt is 'all', cyclpoly returns all the polynomials it finds that satisfies this condition in a matrix of binary row vectors, which each row representing an individual polynomial.

Version History

Introduced before R2006a