The Theory
General Concepts
Channel Coding
Designed to improve
communications performance by
enabling the transmitted signals
to better withstand the effects of
various channel impairments,
such as noise, interference, and
fading.
Hamming Distance
The number of bit positions in which two binary
words differ.
110
010
011
This figure has a minimum
distance between code words
of 1.
111
000
100
001
101
Hamming Distance of 2
A code word that differs
by a Hamming distance
of 2 will detect an
erroneous code word.
0011
0001
0111
r=1
0000
0110
If the minimum distance is 3, the code
words are separated by at least three
edges.
Note that if a single error
occurs, the erroneous code
word will be closer to one of
the correct code words.
The error is corrected by assigning
the received code word to the
nearest (in Hamming distance)
The important concepts
associated with Hamming
distance
are:
1. When
the Hamming distance is 1, it
is impossible to detect an error,
much less correct the error.
2. When the Hamming distance is 2,
the error can be detected, but not
corrected.
3. When the Hamming distance is 3, a
single error can be detected and
corrected.
More Theory
Mathematical Concepts
LINEAR BLOCK CODES
Definition
A systematic (n,k) linear block
code is a mapping from a kdimensional message vector to
an n-dimensional codeword in
such a way that part of the
sequence generated coincides
with the k message digits.
n-dimensional
information
vector, where n =
7.
The linear block
code that
everyone uses is
the (7,4) code.
k-dimensional
information
vector, where k =
Information
Code
0000
0000000
0001
1010001
0010
1110010
0011
0100011
0100
0110100
0101
1100101
0110
1000110
0111
0010111
1000
1101000
1001
0111001
1010
0011010
1011
1001011
1100
1011100
1101
0001101
1110
0101110
1111
1111111
Generator Matrix
How do you generate a (7,4)
code?
Of course with a Generator Matrix!
G P Ik
Note that m = n k, the difference
p11
p
21
p12
...
p1m
p 21
...
...
p2m
...
p nm
p n1
pn2
1 0 ... 0
0 1 ... 0
...
0 0 ... 1
A (7,4) code is generated by the
matrix
1
0
G
1
1 0 1 0 0 0
1 1 0 1 0 0
1 1 0 0 1 0
0 1 0 0 0 1
v u[G ]
The (7,4) block code is generated
using the matrix equation
v u[G ]
where
1.
2.
3.
u is a [1 k] vector representing the
information word
v is a [1 n] vector representing the
code word
[G] is a [k n] generating matrix
For the information word (0 0 0
1), the code word is computed as
follows:
1 1 0 1 0 0 0
0 1 1 0 1 0 0
v u[G ] 0 0 0 1
1 1 1 0 0 1 0
1
0
1
0
0
0
1
Transformation
from 4-bit
information word
to 7-bit code
word
Note that the
additions are
v 1 0 1 0 0 0 1 modulo-2 additions
The Hamming distance for the
(7,4) code is 3.
Thus, this code can detect double bit
errors and correct single bit errors
Parity Check Matrix
Another important matrix
associated with block codes is the
parity check matrix, [H].
The parity check matrix is formed
by starting with the identity
matrix and appending the
transpose of the nonidentity
portion of [G]:
H I k PT
1 0 ... 0
0 1 ... 0
...
0 0 ... 1
p11
p12
p1m
p 21
p 22
p2m
...
...
...
...
p n1
p n 2
p nm
For the (7,4) block code,
1 0 0 1 0 1 1
H 0 1 0 1 1 1 0
0 0 1 0 1 1 1
The Syndrome
The parity check matrix has the property
v[H] T = 0
That is, any errorless, received code
word multiplied by the transpose of the
parity check matrix, [H], yields a zero
vector, or syndrome.
If the received code word contains an error,
the resulting vector will match the
corresponding bit that caused the error.
Consider one of the valid code
words of the (7,4) block code, v =
1100101 and the transpose of the
(7,4) parity check matrix.
v H
1
0
1 1 0 0 1 0 1 1
0
1
1
0
1
0
1
1
1
0
0
1
0
1
1
1
1 0 0
0
1
0
0 0 1
1 1 0 0 1 0 1 1 1 0 1 0 0 0 0 0 1 0
0 1 1
Modulo-2
1 1 1
000
Addition
1
0
1
0
1 0 1
0 11
0
1
0
0 0 1
11 0
1 1 0 0 1 0 1 1 1 0 0 1 0 0 1 0 0 0
0 1 1
1 1 1
1
0
1
1 0 0
0
1
0
0 0 1
1 1 0 0 1 0 1 1 1 0 0 0 0 0 1 0 1 0
0 1 1
1 1 1
1
0
1
1 0 0
0
1
0
0 0 1
v H 1 1 0 0 1 0 1 1
0
1
T
Syndrome
1 0 0 0 0
1 1
The null vector
1 1
indicates no error.
0 1
Suppose the valid code words, v
= 1100101 gets corrupted to
1000101.
1 0 0
0
1
0
0 0 1
T
v H 1 0 0 0 1 0 1 1 1 0
0 1 1
1 1 1
1
0
1
1 0 0
0
1
0
0 0 1
1 0 0 0 1 0 1 1 1 0 1 0 0 0 0 0 1 0
0 1 1
Modulo-2
1 1 1
000
Addition
1
0
1
0
1 0 1
0 11
0
1
0
0 0 1
11 0
1 0 0 0 1 0 1 1 1 0 0 0 0 0 1 0 0 1
0 1 1
1 1 1
1
0
1
1 0 0
0
1
0
0 0 1
1 0 0 0 1 0 1 1 1 0 0 0 0 0 1 0 1 0
0 1 1
1 1 1
1
0
1
The second row
corresponds to
the second bit
from left.
1 0 0
0
1
0
0 0 1
v H 1 0 0 0 1 0 1 1
0
1
T
Syndrom
e
1 0 0 1 0
1 1 Match syndrome with
1 1 corresponding code in
0 1 parity check matrix
Each row in the transposed parity
check matrix corresponds to a bit
in the code word.
By matching the non-zero syndrome
with the contents contained in the
rows of the transposed parity matrix,
the corresponding corrupted bit can
be detected and and subsequently
corrected.
The process will convert the
erroneous code 1000101 to the
correct code 1100101.