3 Ta Engg2310 Tut11
3 Ta Engg2310 Tut11
Xiangyu Zhong
. . . . . .
Xiangyu Zhong (CUHK) IERG2310 Tutorial 11 1 / 12
Outline
I Basic Concepts
I Exercises
. . . . . .
Xiangyu Zhong (CUHK) IERG2310 Tutorial 11 2 / 12
Basic Concepts
Error Control Coding
I The coding procedure done to control the occurrences of errors,
including error detection, and/or error correction.
I Basic idea: add redundancy (i.e., extra bits). Or, put another way,
disallow some codewords; if you receive such an invalid codeword,
correct it to the closest valid codeword.
I Check bits are computed from the message bits according to the
specific encoding rule.
. . . . . .
Xiangyu Zhong (CUHK) IERG2310 Tutorial 11 3 / 12
Basic concepts
Let C is the set of all valid codewords for an (n, k) binary block code,
and c1 , c2 ∈ C are 2 valid codewords.
Concept Definition
Code Rate k/n
Hamming Distance dH (c1 , c2 ) := |c1 − c2 |
d∗H := min dH (c1 , c2 )
Minimum Distance c1 ̸=c2 ,
c1 ,c2 ∈C
. . . . . .
Xiangyu Zhong (CUHK) IERG2310 Tutorial 11 4 / 12
Basic concepts
Description Expression
A code can detect up to d errors
d∗H ≥ d + 1
per codeword if:
A code can correct up to c errors
d∗H ≥ 2c + 1
per codeword if:
A code can detect up to d errors
and correct up to c < d errors per d∗H ≥ d + c + 1
codeword if:
. . . . . .
Xiangyu Zhong (CUHK) IERG2310 Tutorial 11 5 / 12
Linear Binary Block Code
Example:
Hamming codes — can detect up to two-bit errors or correct single-bit
errors.
Repetition codes (p.3) and single parity check bit codes (p.2).
. . . . . .
Xiangyu Zhong (CUHK) IERG2310 Tutorial 11 6 / 12
Exercise
Exercise 1:
Consider a binary linear block code of the form:
[d1 d2 d3 p1 p2 p3 ]
where d1 , d2 , d3 are message bits and p1 , p2 , p3 are check bits given by
p1 = d1 + d2 mod 2
p2 = d2 + d3 mod 2
p3 = d1 + d3 mod 2
list out all the codewords.
. . . . . .
Xiangyu Zhong (CUHK) IERG2310 Tutorial 11 7 / 12
Exercise
Exercise 1:
Consider a binary linear block code of the form:
[d1 d2 d3 p1 p2 p3 ]
where d1 , d2 , d3 are message bits and p1 , p2 , p3 are check bits given by
p1 = d1 + d2 mod 2
p2 = d2 + d3 mod 2
p3 = d1 + d3 mod 2
list out all the codewords.
Solution:
[0 0 0 0 0 0], [0 0 1 0 1 1]
[0 1 0 1 1 0], [0 1 1 1 0 1]
[1 0 0 1 0 1], [1 0 1 1 1 0]
[1 1 0 0 1 1], [1 1 1 0 0 0]
. . . . . .
Xiangyu Zhong (CUHK) IERG2310 Tutorial 11 8 / 12
Exercise
Exercise 2:
Consider an (8, 4) binary linear block code with minimum distance of 4.
I How many valid codewords are there?
I What is the code rate?
I What is the minimum weight of the code?
I If the code is used for error detection only, how many errors can it
detect?
I If the code is used for error correction, how many errors can it correct?
. . . . . .
Xiangyu Zhong (CUHK) IERG2310 Tutorial 11 9 / 12
Exercise
Exercise 2:
Consider an (8, 4) binary linear block code with minimum distance of 4.
I How many valid codewords are there?
I What is the code rate?
I What is the minimum weight of the code?
I If the code is used for error detection only, how many errors can it
detect?
I If the code is used for error correction, how many errors can it correct?
Solution:
I 24 = 16.
I 4/8 = 0.5.
∗ ∗
I wH = 4, since wH = d∗H for linear block codes.
∗
I d = 4, by dH ≥ d + 1.
I c = 1, by d∗H ≥ 2c + 1.
. . . . . .
Xiangyu Zhong (CUHK) IERG2310 Tutorial 11 10 / 12
Exercise
Exercise 3:
Consider a binary linear block code of the form:
[d1 d2 p1 p2 p3 ]
where d1 , d2 are message bits and p1 , p2 , p3 are check bits given by
p1 = d1 + d2 mod 2
p2 = d1 mod 2
p3 = d2 mod 2
Get the error detecting and correcting capabilities.
. . . . . .
Xiangyu Zhong (CUHK) IERG2310 Tutorial 11 11 / 12
Exercise
Exercise 3:
Consider a binary linear block code of the form:
[d1 d2 p1 p2 p3 ]
where d1 , d2 are message bits and p1 , p2 , p3 are check bits given by
p1 = d1 + d2 mod 2
p2 = d1 mod 2
p3 = d2 mod 2
Get the error detecting and correcting capabilities.
Solution:
First, we can list all the valid codewords as follows:
[0 0 0 0 0], [0 1 1 0 1]
[1 0 1 1 0], [1 1 0 1 1]
∗
As observed, the minimum weight wH = 3. Since this is a linear block code,
∗ ∗
we have dH = wH = 3.
Thus, the error detection capability is d = 2 and the code correction
capability is c = 1.
. . . . . .
Xiangyu Zhong (CUHK) IERG2310 Tutorial 11 12 / 12
Assignment 5
The low-pass signal x(t) with bandwidth W is sampled with a sampling interval of
Ts , and the signal
∞
X
xp (t) = x(nTs )p(t − nTs )
n=−∞
The input samples are distributed according to the probability density function:
(
|x|, 0 ≤ x ≤ 1
fX (x) =
0, else
clear; clc;
% Convergence check
diff = max(abs(new_thresholds - thresholds));
thresholds = new_thresholds; % Update thresholds
end
% Display results
disp(’Optimal Quantization Levels:’);
disp(q);
disp(’Optimal Decision Boundaries:’);
disp(thresholds);