Communications Toolbox    

Performing Other 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 cyclic, BCH, and Reed-Solomon codes, use the functions cyclpoly, bchpoly, and rspoly, respectively. The commands

all 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.

For generic cyclic coding, there might be more than one generator polynomial consistent with a given codeword length and message length. The cyclpoly command syntax includes ways to retrieve all of them or those that satisfy certain constraints that you specify. For example, the command

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

See the reference pages for cyclpoly, bchpoly, and rspoly for details about other options.

Finding Generator and Parity-Check Matrices

To find a parity-check and generator matrix for a Hamming code with codeword length 2m-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 command 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. Since 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

The error-correction capability of BCH codes and Reed-Solomon codes depends on the codeword length and message length. The functions bchpoly and rspoly perform such computations. To retrieve the error-correction capability t of BCH and Reed-Solomon codes, respectively, use the commands below.

For Reed-Solomon codes, the error-correction capability is floor((n-k)/2); for BCH codes, there is no easy formula.


 Creating and Decoding Block Codes Selected Bibliography for Block Coding