Chap_06
Chap_06
Digital Communications
ECE 6640 2
Sklar’s Communications System
Notes and figures are based on or taken from materials in the course textbook:
ECE 6640 Bernard Sklar, Digital Communications, Fundamentals and Applications, 3
Prentice Hall PTR, Second Edition, 2001.
Signal Processing Functions
Notes and figures are based on or taken from materials in the course textbook:
ECE 6640 Bernard Sklar, Digital Communications, Fundamentals and Applications, 4
Prentice Hall PTR, Second Edition, 2001.
Encoding and Decoding
Data
Encoder Codeword
Block
Data
Decoder Codeword
Block
ECE 6640 5
Waveform Coding Structured Sequences
• Waveform Coding:
– Transforming waveforms in to “better” waveform representations
– Make signals antipodal or orthogonal
• Structured Sequences:
– Transforming waveforms in to “better” waveform representations
that contain redundant bits
– Use redundancy for error detection and correction
– Bit sets become longer bit sets (redundant bits) with better
“properties”
– The required bit rate for transmission increases.
ECE 6640 6
Antipodal and Orthogonal Signals
• Antipodal
– Distance is twice “signal voltage”
– Only works for one-dimensional signals
1
T
1 for i j
d 2 Eb z ij s i t s j t dt
E 0 1 for i j
• Orthogonal
– Orthogonal symbol set
– Works for 2 to N dimensional signals
1
T
1 for i j
d 2 Eb z ij s i t s j t dt
E 0 0 for i j
ECE 6640 7
M-ary Signals Waveform Coding
sumb
K N
i
b sum b ik b kj
j
k k
1 for i j
z ij k 1 k 1
K 0 for i j
ECE 6640 8
Hadamard Matrix Orthogonal Codes
H D 1 H D 1
HD
H D 1 H D 1
• Start with the data set for one bit and generate a Hadamard
code for the data set
0 0 0
1 H 1 0 1
0 0 0 0 0 0
0 1 H1 0
H1 1 0 1
H2
1 0 H1 H1 0 0 1 1
0 1 1 0
1 1
1 for i j
z ij
ECE 6640 0 for i j 9
Hadamard Matrix Orthogonal Codes (2)
0 0 0 0 0 0 0 0 0 0 0
0 1 0
0
1 0 1 0 1 0 1
0 1 0 0 0 1 1 0 0 1 1
0 1 1 H H 2 0 1 1 0 0 1 1 0
Data Set Codeword
H3 2
1 0 0 H 2 H 2 0 0 0 0 1 1 1 1
0
1 0 1 1 0 1 1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0 0
0 0 4 0 0 0 -4 0
0 0 0 4 0 0 0 -4
-4 0 0 0 4 0 0 0
0 -4 0 0 0 4 0 0
0 0 -4 0 0 0 4 0
0 0 0 -4 0 0 0 4
ECE 6640 16
Biorthogonal Codes (3)
Es 2 Es M 2 k 1
PE M M 2 Q
Q
N0 N0 Es k E b
PB M PE M , for M 8
2
ECE 6640 17
Biorthogonal Codes (4)
M E S M 2k
Hadamard
PB M Q
2 N 0 Es k E b
ECE 6640 18
Waveform Coding System Example
ECE 6640 19
Waveform Coding System Example (2)
Direct Sequence
Spread Spectrum
(DSSS) Related
ECE 6640 21
Waveform Coding System Example (4)
Stated Improvement Tb k T
2 k
C
ECE 6640 22
Types of Error Control
• Types of codes
– Block Codes or Linear Block Codes (Chap. 6)
– Convolutional Codes (Chap. 7)
– Turbo Codes (Chap. 8)
ECE 6640 24
Channel Models
ECE 6640 25
Code Rate Redundancy
ECE 6640 26
Binary Bit Error Probability
j
n! j
P j , n p 1 p n j
j!n j !
E x n p
E x 2 n p 1 p
ECE 6640 27
Code Example Triple Redundancy
0!3 0 !
3!
P1,3 0.001 0.999 3 0.001 0.999 0.002994
1 2 1 2
1!3 1!
3!
P2,3 0.001 0.999 3 0.001 0.999 0.000002997
2 1 2 1
2!3 2 !
3!
P3,3 0.001 0.001 10 9
3 3
3!3 3!
Code Example Triple Redundancy
ECE 6640 30
(4,3) Single-Parity-Code
ECE 6640 32
Matlab Results
-3
10
-4
10
-5
10
-6
ECE 6640 10 33
2 4 6 8 10 12 14 16
Channel Bits
Rectangular Code
ECE 6640 34
Rectangular Code Example
j t 1 j
n t 1
PM p 1 p n t 1
ECE 6640
t 1 35
Error-Correction Code Tradeoffs
• Tradeoffs
– Error performance vs. bandwidth
• More bits per sec implies more bandwidth
– Power Output vs. bandwidth
• Lowering Eb/No changer BER, to get it back, encode and increase
bandwidth
• If communication need not be in real time … sending more
bits increases BER at the cost of latency!
ECE 6640 36
Coding Gain
Note:
Code gain exists for a given BER.
(CB @ 1e-4 or ED @ 1e-6 in the figure)
CG may be different at different BERs!
ECE 6640 37
Data Rate vs. Bandwidth
Eb PS W PS 1
N 0 N 0 W R N 0 R
ECE 6640 38
Linear Block Codes
• Encoding methodology
– A giant table lookup
– Generators that can span the subspace to create the desired linear
independent sets can be defined
ECE 6640 39
Linear Block Code Structure
ECE 6640 40
Generator Matrix
k
V vk 1 vk 2 vkn
ECE 6640 41
Table 6.1 Example
% Simple single bit parity
n = 6; k = 3; % Set codeword length and message length.
msg = [0 0 0; 0 0 1; 0 1 0; 0 1 1; ...
1 0 0; 1 0 1; 1 1 0; 1 1 1]; % Message is a binary matrix.
gen = [ 1 1 0 1 0 0; ...
0 1 1 0 1 0; ...
1 0 1 0 0 1];
0 0 0 0 0 0
1 0 1 0 0 1
0 1 1 0 1 0
1 1 0 0 1 1
1 1 0 1 0 0
0 1 1 1 0 1
To Match:
1 0 1 1 1 0 swap c2 and c3
0 0 0 1 1 1
swap c4 and c6
A Systematic Code A Systematic Code with
ECE 6640 42
shifted message
“Systematic” Linear Block Codes
G P I k
ECE 6640 44
Parity Check Matrix
H I nk PT
I
U H T m P | I k H T m P | I k n k 0 mr ,n k
P
ECE 6640 45
Parity Check Matrix
[parmat,genmat] = hammgen(3)
rem(genmat * parmat', 2)
[parmat,genmat] = cyclgen(7,cyclpoly(7,4))
rem(genmat * parmat', 2)
ECE 6640 46
Syndrome Testing
ECE 6640 48
Standard Array Format (n,k)
ECE 6640 50
Decoding with the Standard Array
ECE 6640 51
The Syndrome of a Coset
ECE 6640 52
Error Correct
ECE 6640 53
Error Correction Example
• see Table61_example
– each step of the process is shown in Matlab for the (6,3) code of
the text
ECE 6640 54
Decoder Implementation
ECE 6640 55
Hamming Weight and Distance
ECE 6640 57
Hamming Distance Capability
d 1
t min
2
– for (6,3) dmin=3: t = 1
j t 1 j
ECE 6640 58
Hamming Distance Capability
• Error-detection capability
e d min 1
– a block code with a minimum distance of dmin guarantees that all
error patterns of dmin-1 or fewer error can be detected.
– for (6,3) dmin=3: e = 2 bits
j 1
– for (6,3) A(0)=1, A(3)=4, A(4)=3, all else A(i)=0
Pnd 4 p 3 1 p 3 p 4 1 p
3 2
4 1 p 3 p p 3 1 p
2
4 p p 3 1 p
2
ECE 6640 60
– for p=0.001: Pnd ~ 3.9 x 10-6
Simultaneous Error
Correction and Detection
• It is possible to trade capability from the maximum
guaranteed (t) for the ability to simultaneously detect a
class of errors.
• A code can be used for simultaneous correction of alpha
errors and detection of beta errors for beta>=alpha
provided
d min 1
ECE 6640 61
Visualization of (6,3) Codeword
Spaces
ECE 6640 62
MATLAB References
• see http://www.mathworks.com/help/comm/error-detection-and-
correction.html
– http://www.mathworks.com/help/comm/block-coding.html
– http://www.mathworks.com/help/comm/linear-block-codes.html
– http://www.mathworks.com/help/comm/bch-codes.html
ECE 6640 63
(8,2) Block Code
see:
BlockCode82.m
ECE 6640 64
Block Codes
• Now that you have seen how to work with block codes …
ECE 6640 65
Code Design: Hamming Bound
nk
n n n
2 1
1 2 t
n-k
– Note that fewer cosets than 2 may be used, for example cosets
corresponding on 1 to t errors and not “additional” slots available
for t+1 errors. (LinBlkCodeTestXX.m examples)
ECE 6640 66
Defining Code Length
n 2 k 1
d min k
2 1
ECE 6640 67
Defining Code Length
ECE 6640 68
MATLAB Examples
• LinBlkCodeTestXX.m
– (3,1), (6,3), (7,4), and (8,2)
– code in linblkcoderxXX.m explicitly defines coset matrix “E”,
– but only 0:t bit error conditions are defined, there are coset errors
conditions that may not be included
(no extras for (3,1) or (7,4) … can you tell me why?)
• (3,1) t=1 … 3 single bit errors 2n-k = 4 cosets available
• (6,3) t=1 … 6 single bit errors 2n-k = 8 cosets available
• (7,4) t=1 … 7 single bit errors 2n-k = 8 cosets available
n-k
• (8,2) t=2 … 8 single bit and 28 two bit errors 2 = 64 cosets
• (n,k) t=z … n single bit errors … 2n-k cosets available
ECE 6640 69
Coset Comments
• See ChCode_MPSK_BJB
– uses linblkcoderxXX.m to decode!
– code the simulation do better?
– If the coset is only partially filled, yes … otherwise, no.
ECE 6640 72
Cyclic Codes
ECE 6640 73
Algebraic Structure of Cyclic Codes
• Based on
U X u0 u1 X u2 X 2 un 1 X n 1
– U(X), an (n-1) degree polynomial code word with the property
X i U X U i X
q X n
X 1n
X 1
X i U X q X X n 1 U i X
– where the final term is the remainder of the division process and it
is also a codeword
– The remainder can also be described in terms of modulo arithmetic
as
U i X X i U X moduloX n 1
ECE 6640 74
Example
U X u0 u1 X u2 X 2 un 1 X n 1
X U X un 1 u0 X u1 X 2 u2 X 2 un 2 X n 1 un 1 X n 1
• The final term module Xn+1 results in a new codeword
X U X un 1 u0 X u1 X 2 u2 X 2 un 2 X n 1
p nk
ECE 6640 76
Binary Cyclic Codes
ECE 6640 79
Well-Known Block Codes
• Hamming Codes
– minimum distance of 3, single error correction codes.
– known as perfect codes, codes where the standard array has all
patterns of t or fewer errors and no others as coset leaders (that is
no residual error-correcting capacity)
• Extended Golay Codes
• Bose-Chadhuri-Hocquenghem (BCH) Codes
– powerful class of cyclic codes
– generalization of Hamming codes that allow multiple error
correction
ECE 6640 80
Hamming Codes
(n-k) m
– 2 = 2 therefore 1 all zeros coset leader
m
and 2 -1=n single bit errors. Always a perfect code!
ECE 6640 81
Code Generation Algorithm
ECE 6640 82
MATLAB hamgen
[H, G, N, K] = hammgen(3)
H=
1 0 0 1 0 1 1
0 1 0 1 1 1 0
0 0 1 0 1 1 1
G=
1 1 0 1 0 0 0
0 1 1 0 1 0 0
1 1 1 0 0 1 0
1 0 1 0 0 0 1
N=
7
K=
4
ECE 6640 83
Performance Improvement
j t 1 j n j t 1 j
2 Ec Ec k Eb
p Q
N0 n N0
N0
– with the results plotted in on Figure 6.22 and the following slide.
ECE 6640 84
Comparative Code Performance
Figure 6.22
ECE 6640 85
Extended Golay Code
1 24 24 j
p 1 p
24 j
PB
24 j 4 j
ECE 6640 86
BCH Codes
• Bose-Chadhuri-Hocquenghem (BCH)
• From Wikipedia: http://en.wikipedia.org/wiki/BCH_code
– One of the key features of BCH codes is that during code design,
there is a precise control over the number of symbol errors
correctable by the code. In particular, it is possible to design binary
BCH codes that can correct multiple bit errors.
– BCH codes are used in applications such as satellite
communications,[2] compact disc players, DVDs, disk drives,
solid-state drives[3] and two-dimensional bar codes.
ECE 6640 87
BCH Code Performance
Figure 6.23
ECE 6640 88
Matlab Block Code Examples
• ChCode_MPSK_BJB
– BPSK, QPSK or 8-PSK Time Symbols at a fixed 1 Mbps channel
symbol bit rate (1 Msps for BPSK, ½ Msps for QPSK, and 1/3
Msps for 8-PSK)
– Linear Block Channel Encoding
• (3,1) with t=1, (6,3) with t=1, (7,4) with t=1, and (8,2) with t=2
– Comparison curve based on symbol bit error rate versus corrected
bit-error rates for the data stream
ECE 6640 89
BPSK Simulation Results
0
Bit Error Rate, M=2 0
Bit Error Rate, M=2
10 10
-1 -1
10 10
-2 -2
10 10
-3 -3
10 10
BER
BER
-4 -4
10 10
-5 -5
10 10
ECE 6640 90
BPSK Simulation Results (2)
0
Bit Error Rate, M=2 0
Bit Error Rate, M=2
10 10
-1
10 10
-1
-2
10 -2
10
-3
10
-3
10
-4
BER
BER
10
-4
10
-5
10
-5
-6 10
10
MPSK Simulation MPSK Simulation
-6
-7 Encoded MPSK Simulation 10 Encoded MPSK Simulation
10
MPSK Theory MPSK Theory
Encoded MPSK Theory Encoded MPSK Theory
-8 -7
10 10
-6 -4 -2 0 2 4 6 8 10 12 -10 -5 0 5 10 15
E b/N0 (dB) E b/N0 (dB)
ECE 6640 91