Communications Toolbox    
cyclgen

Produce parity-check and generator matrices for cyclic code

Syntax

Description

For all syntaxes, the codeword length is n and the message length is k. A polynomial can generate a cyclic code with codeword length n and message length k if and only if the polynomial is a degree-(n-k) divisor of xn-1. (Over the binary field GF(2), xn-1 is the same as xn+1.) This implies that k equals n minus the degree of the generator polynomial.

parmat = cyclgen(n,pol) produces an (n-k)-by-n parity-check matrix for a systematic binary cyclic code having codeword length n. The row vector pol gives the binary coefficients, in order of ascending powers, of the degree-(n-k) generator polynomial.

parmat = cyclgen(n,pol,opt) is the same as the syntax above, except that the argument opt determines whether the matrix should be associated with a systematic or nonsystematic code. The values for opt are 'system' and 'nonsys'.

[parmat,genmat] = cyclgen(...) is the same as parmat = cyclgen(...) except that it also produces the k-by-n generator matrix genmat that corresponds to the parity-check matrix parmat.

[parmat,genmat,k] = cyclgen(...) is the same as [parmat,genmat] = cyclgen(...) except that it also returns the message length k.

Examples

The code below produces parity-check and generator matrices for a binary cyclic code with codeword length 7 and message length 4.

In the output below, notice that the parity-check matrix is different from parmat above, since it corresponds to a nonsystematic cyclic code. In particular, parmatn does not have a 3-by-3 identity matrix in its leftmost three columns, as parmat does.

See Also
cyclpoly, encode


 convenc cyclpoly