Main Content

Produce parity-check and generator matrices for cyclic code

`h = cyclgen(n,pol)`

h = cyclgen(n,pol,* opt*)

[h,g] = cyclgen(...)

[h,g,k] = cyclgen(...)

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 x`^n`

-1. (Over the binary field GF(2),
x`^n`

-1 is the same as x`^n`

+1.)
This implies that `k`

equals `n`

minus
the degree of the generator polynomial.

`h = 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. Alternatively, you can specify `pol`

as a polynomial
character vector. For more information, see Character Representation of Polynomials.

`h = cyclgen(n,pol,`

is
the same as the syntax above, except that the argument * opt*)

`opt`

`opt`

`'system'`

and
`'nonsys'`

.`[h,g] = cyclgen(...)`

is
the same as `h = cyclgen(...)`

, except that it also
produces the `k`

-by-`n`

generator
matrix `g`

that corresponds to the parity-check matrix `h`

.

`[h,g,k] = cyclgen(...)`

is
the same as `[h,g] = cyclgen(...)`

, except that it
also returns the message length `k`

.