Main Content

syndtable

Produce syndrome decoding table

Description

t = syndtable(h) returns a decoding table for an error-correcting binary code having codeword length n and message length k. h is an (nk)-by-n parity-check matrix for the code.

The function interprets the leftmost column as the most significant digit when converting between binary and decimal values.

example

Examples

collapse all

A decoding table tells a decoder how to correct errors that 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 codeword.

The Communications toolbox represents a decoding table as a matrix with n columns and 2n-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.

This example uses a Hamming decoding table to correct an error in a received message. The hammgen function produces the parity-check matrix and the syndtable function produces the decoding table. To determine the syndrome, multiply the transpose of the parity-check matrix by the received codeword. The decoding table helps determine the correction vector. The corrected codeword is the sum (modulo 2) of the correction vector and the received codeword.

Set parameters for a [7,4] Hamming code.

m = 3; 
n = 2^m-1; 
k = n-m;

Produce a parity-check matrix and decoding table.

parmat = hammgen(m);    
trt = syndtable(parmat);

Specify a vector of received data.

recd = [1 0 0 1 1 1 1]
recd = 1×7

     1     0     0     1     1     1     1

Calculate the syndrome and then display the decimal and binary values for the syndrome.

syndrome = rem(recd * parmat',2);
syndrome_int = bit2int(syndrome',m); % Convert to decimal.
disp(['Syndrome = ',num2str(syndrome_int), ...
      ' (decimal), ',num2str(syndrome),' (binary)'])
Syndrome = 3 (decimal), 0  1  1 (binary)

Determine the correction vector by using the decoding table and syndrome, and then compute the corrected codeword by using the correction vector.

corrvect = trt(1+syndrome_int,:)
corrvect = 1×7

     0     0     0     0     1     0     0

correctedcode = rem(corrvect+recd,2)
correctedcode = 1×7

     1     0     0     1     0     1     1

Input Arguments

collapse all

Parity-check matrix, specified as a (nk)-by-n matrix where n is the codeword length and k is the message length.

Data Types: single | double

Output Arguments

collapse all

Decoding table for an error-correcting binary code, specified as a 2nk-by-n binary matrix. The rth row of t is an error pattern for a received binary codeword whose syndrome has decimal integer value r—1 and represents the coset leaders from the code's standard array.

Data Types: single | double

References

[1] Clark, George C., Jr., and J. Bibb Cain, Error-Correction Coding for Digital Communications, New York, Plenum, 1981.

Version History

Introduced before R2006a