| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Communications Toolbox |
| Contents | Index |
| Learn more about Communications Toolbox |
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.
h = 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'.
[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.
The code below produces parity-check and generator matrices for a binary cyclic code with codeword length 7 and message length 4.
pol = cyclpoly(7,4); [parmat,genmat,k] = cyclgen(7,pol)
The output is
parmat =
1 0 0 1 1 1 0
0 1 0 0 1 1 1
0 0 1 1 1 0 1
genmat =
1 0 1 1 0 0 0
1 1 1 0 1 0 0
1 1 0 0 0 1 0
0 1 1 0 0 0 1
k =
4
In the output below, notice that the parity-check matrix is different from parmat above, because 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.
parmatn = cyclgen(7,cyclpoly(7,4),'nonsys')
parmatn =
1 1 1 0 1 0 0
0 1 1 1 0 1 0
0 0 1 1 1 0 1
encode, decode, bchgenpoly, cyclpoly, Block Coding
![]() | crc.generator | cyclpoly | ![]() |

Learn how to apply early verification to your development process through these technical resources.
How much time do you spend on testing to ensure implementation meets system-level requirements?
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |