Communications Toolbox    

Performing Other Binary Block Code Tasks

This section describes functions that compute typical parameters associated with block codes and functions that convert information from one format to another. Specific tasks are

Finding a Generator Polynomial

To find a generator polynomial for a cyclic or BCH code, use the cyclpoly or bchpoly function, respectively. The commands

represent valid ways to find one generator polynomial for a [7,4] code of the respective coding method. The result is suitable for use in other block coding functions, such as encode or rsenc.

Some pairs of message length and codeword length do not uniquely determine the generator polynomial. The syntax for cyclpoly includes ways to retrieve all valid generator polynomials or those that satisfy certain constraints that you specify. See the reference page for cyclpoly for details about syntax options.

For example, the command

shows that 1 + x2 + x3 and 1 + x + x3 are two possible generator polynomials for a [7,4] cyclic code.

Finding Generator and Parity-Check Matrices

To find a parity-check and generator matrix for a Hamming code with codeword length 2^m-1, use the hammgen function as below. m must be at least three.

To find a parity-check and generator matrix for a cyclic code, use the cyclgen function. You must provide the codeword length and a valid generator polynomial. You can use the cyclpoly function to produce one possible generator polynomial after you provide the codeword length and message length. For example,

To find a parity-check and generator matrix for a BCH code, use the same cyclgen function mentioned above. Because the generator polynomial must now be valid for BCH code, the bchpoly function replaces cyclpoly.

Converting Between Parity-Check and Generator Matrices

The gen2par function converts a generator matrix into a parity-check matrix, and vice versa. Examples to illustrate this are on the reference page for gen2par.

Finding the Error-Correction Capability of a BCH Code

The bchpoly function can compute the error-correction capability of a BCH code, which depends on the codeword length and message length. To retrieve the error-correction capability t of a BCH code, use the command below.


  Creating and Decoding Binary Block Codes Representing Words for Reed-Solomon Codes