Communications Toolbox    

Parameters for Binary Block Codes

This subsection describes the items that you might need in order to process [n,k] binary linear block codes. The table below lists the items and the coding techniques for which they are most relevant.

Parameters Used in Block Coding Techniques 
Parameter
Block Coding Technique
Generator Matrix
Generic linear block
Parity-Check Matrix
Generic linear block
Generator Polynomial
Cyclic, BCH
Decoding Table
Generic linear block, Hamming

Generator Matrix

The process of encoding a message into an [n,k] linear block code is determined by a k-by-n generator matrix G. Specifically, the 1-by-k message vector v is encoded into the 1-by-n codeword vector vG. If G has the form [Ik P] or [P Ik], where P is some k-by-(n-k) matrix and Ik is the k-by-k identity matrix, then G is said to be in standard form. (Some authors, e.g., Clark and Cain [1], use the first standard form, while others, e.g., Lin and Costello [2], use the second.) Most functions in this toolbox assume that a generator matrix is in standard form when you use it as an input argument.

Some examples of generator matrices are in the next section, Parity-Check Matrix.

Parity-Check Matrix

Decoding an [n,k] linear block code requires an (n-k)-by-n parity-check matrix H. It satisfies GHtr = 0 (mod 2), where Htr denotes the matrix transpose of H, G is the code's generator matrix, and this zero matrix is k-by-(n-k). If G = [Ik P] then H = [-Ptr In-k]. Most functions in this toolbox assume that a parity-check matrix is in standard form when you use it as an input argument.

The table below summarizes the standard forms of the generator and parity-check matrices for an [n,k] binary linear block code.

Type of Matrix
Standard Form
Dimensions
Generator
[Ik P] or [P Ik]
k-by-n
Parity-check
[-P' In-k] or [In-k -P' ]
(n-k)-by-n

Ik is the identity matrix of size k and the ' symbol indicates matrix transpose. (For binary codes, the minus signs in the parity-check form listed above are irrelevant; that is, -1 = 1 in the binary field.)

Examples.   In the command below, parmat is a parity-check matrix and genmat is a generator matrix for a Hamming code in which [n,k] = [23-1, n-3] = [7,4]. Notice that genmat has the standard form [P Ik].

The next example finds parity-check and generator matrices for a [7,3] cyclic code. The cyclpoly function is mentioned below in Generator Polynomial.

The example below converts a generator matrix for a [5,3] linear block code into the corresponding parity-check matrix.

The same function gen2par can also convert a parity-check matrix into a generator matrix.

Generator Polynomial

Cyclic codes, including the special case of BCH codes, have algebraic properties that allow a polynomial to determine the coding process completely. This so-called generator polynomial is a degree-(n-k) divisor of the polynomial xn-1. Van Lint [4] explains how a generator polynomial determines a cyclic code.

The cyclpoly and bchpoly functions produce generator polynomials for generic cyclic codes and BCH codes, respectively. These functions represent a generator polynomial using a row vector that lists the polynomial's coefficients in order of ascending powers of the variable. For example, the command

finds that one valid generator polynomial for a [7,3] cyclic code is 1 + x2 + x3 + x4.

Decoding Table

A decoding table tells a decoder how to correct errors that might have corrupted the code during transmission. Hamming codes can correct any single-symbol error in any codeword. Other codes can correct, or partially correct, errors that corrupt more than one symbol in a given codeword.

This toolbox represents a decoding table as a matrix with n columns and 2^(n-k) rows. Each row gives a correction vector for one received codeword vector. A Hamming decoding table has n+1 rows. The syndtable function generates a decoding table for a given parity-check matrix.

Example: Using a Decoding Table.   The script below shows how to use a Hamming decoding table to correct an error in a received message. The hammgen function produces the parity-check matrix, while the syndtable function produces the decoding table. The transpose of the parity-check matrix is multiplied on the left by the received codeword, yielding the syndrome. The decoding table helps determine the correction vector. The corrected codeword is the sum (modulo 2) of the correction vector and the received codeword.

The output is below.


  Representing Words for Binary Block Codes Creating and Decoding Binary Block Codes