Chapter 8 · 7 hours
Error Detection and Correction Coding
IOE past exam questions
Past questions and answers
23 questions set from this chapter, 4 of them more than once. Most asked first.
- Asked 5 times
- 2071 Magh (old course) · 4 marks
- 2068 Jestha (old course) · 5 marks
- 2080 Bhadra (CS II) · 4 marks
- 2079 Bhadra (CS II) · 5 marks
- 2075 Chaitra (CS II) · 5 marks
Write a short note on convolutional codes.
Answer
A convolutional code is an error-correcting code in which the encoder has memory: each group of output bits depends on the current input bit and on the previous input bits stored in a shift register. The code is described by : input bits produce output bits, giving code rate , and is the constraint length.
Encoder
A rate-1/2, encoder with generators and :
m -->[ m_i ]-->[ m_i-1 ]-->[ m_i-2 ]
| \ | / |
| \--(+)--+--------/ | c1 = mi+mi-1+mi-2
| |
+---------(+)------------+ c2 = mi+mi-2
output: c1 c2 c1 c2 ...
Each output is the modulo-2 convolution of the input with a generator sequence: .
Example: input 1 0 0 1 1 (plus two flushing 0s) gives 11 10 11 11 01 01 11.
Representations
- Code tree: branches up for 0, down for 1, labelled with output bits.
- Trellis diagram: states (contents of memory) against time; repeats after steps.
- State diagram: states with transitions labelled input/output.
Decoding
The Viterbi algorithm (maximum-likelihood) finds the trellis path with minimum Hamming distance from the received sequence; sequential decoding is used for large .
Features
- Works on a continuous bit stream, no block division.
- Strong error correction with soft-decision decoding; free distance measures power.
- Used in GSM, satellite and deep-space links, Wi-Fi (often with interleaving).
- Asked 2 times
- 2080 Baisakh (CS II) · 10 marks
- 2070 Asar (CS II) · 1+4 marks
What is binary Cyclic code? Construct a (7,4) binary Cyclic Code using a generator polynomial g(x) = x³ + x² + 1 with data Vector (1011).
Answer
Binary cyclic code
A binary cyclic code is a linear block code in which every cyclic shift of a codeword is also a codeword. If is a codeword, so is .
Code vectors are treated as polynomials . An cyclic code is defined by a generator polynomial of degree that divides . Every codeword is a multiple of . Cyclic codes are easy to encode and decode with shift registers (used in CRC).
Given
, , . It is a valid generator since .
Convention: the leftmost data bit is the highest power. Data :
All arithmetic is modulo 2 ().
(a) Non-systematic codeword
(three terms leave one .)
Non-systematic code vector: 1 1 1 1 1 1 1
(b) Systematic codeword
Steps: multiply by , divide by , append the remainder as parity bits.
Long division by :
x^3 + x^2 <- quotient
---------------------------
x^3+x^2+1 ) x^6 + x^4 + x^3
x^6 + x^5 + x^3
-----------------------
x^5 + x^4
x^5 + x^4 + x^2
-------------------
x^2 <- remainder
Remainder , i.e. parity bits .
Check: , a multiple of , so it is a valid codeword.
Systematic code vector: 1 0 1 1 | 1 0 0 (data bits followed by parity bits).
Shift-register encoder check
The remainder can be produced by a 3-stage feedback shift register (taps at the non-zero coefficients of ). With feedback , the update is , , .
| Input (MSB first) | ||||
|---|---|---|---|---|
| start | 0 | 0 | 0 | |
| 1 | 1 | 1 | 0 | 1 |
| 0 | 1 | 1 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 |
| 1 | 0 | 0 | 0 | 1 |
After 4 shifts the register holds , i.e. remainder ; read out , the same parity bits as the long division. The 4 data bits are sent first, then the gate opens and the 3 parity bits follow.
| Form | Code vector |
|---|---|
| Non-systematic | 1111111 |
| Systematic | 1011100 |
- Asked 2 times
- 2076 Asoj (CS II) · 4+5 marks
- 2074 Asoj (CS II) · 2+6 marks
Define Hamming Weight and Hamming Distance. Construct a (7, 4) cyclic code using a generator polynomial g(x) = x³ + x² + 1 with data vector 1011.
Answer
Hamming weight
The Hamming weight of a code vector is the number of non-zero (1) elements in it.
Example: , .
Hamming distance
The Hamming distance between two code vectors of equal length is the number of positions in which they differ. It equals the weight of their modulo-2 sum: .
Example: , ; , so .
The smallest distance between any two codewords is the minimum distance ; for a linear code it equals the smallest non-zero weight. A code detects up to errors and corrects up to . For the (7,4) cyclic Hamming code : it detects 2 and corrects 1 error.
(7,4) cyclic code for data 1011
Given , . Convention: leftmost bit = highest power, so . Modulo-2 arithmetic.
Non-systematic form:
Non-systematic code vector: 1111111.
Systematic form:
- Divide by :
x^3 + x^2
-------------------------
x^3+x^2+1 ) x^6 + x^4 + x^3
x^6 + x^5 + x^3
-----------------------
x^5 + x^4
x^5 + x^4 + x^2
-------------------
x^2
- Remainder , parity bits .
- .
Systematic code vector: 1011 100 (message, then parity).
Check: , so is divisible by and is a valid codeword.
| Form | Code vector | Weight |
|---|---|---|
| Non-systematic | 1111111 | 7 |
| Systematic | 1011100 | 4 |
- Asked 2 times
- 2072 Chaitra (CS II) · 2+4 marks
- 2071 Chaitra (CS II) · 2+4 marks
Define Hamming weight and Hamming distance for a code vector x = (0111000) and the parity check matrix H given below. Prove that, the given code is valid.
H = [1 1 1 0 1 0 0; 1 1 0 1 0 1 1; 1 0 1 1 0 0 1] (3×7)
Answer
Hamming weight
The Hamming weight of a code vector is the number of 1s in it. For :
Hamming distance
The Hamming distance between two code vectors is the number of positions in which they differ, . For example, distance of from the all-zero codeword is , and from it is .
Proof that x is a valid codeword
A vector is a valid codeword of the code if and only if its syndrome is zero:
Only positions 2, 3 and 4 of are 1, so is the modulo-2 sum of columns 2, 3 and 4 of :
| Row | Col 2 | Col 3 | Col 4 | Sum (mod 2) |
|---|---|---|---|---|
| 1 | 1 | 1 | 0 | |
| 2 | 1 | 0 | 1 | |
| 3 | 0 | 1 | 1 |
Since the syndrome is the zero vector, satisfies all three parity-check equations. Hence the given code vector is valid.
- 2081 Chaitra · 2+4+4 marks
A (6, 3) error control code has the following parity check matrix.
H = [1 0 1 1 0 0; 1 1 0 0 1 0; 0 1 1 0 0 1]
a) Determine the generator matrix G
b) Generate a codeword for message 110
c) Check whether the received code word 110111 has error or not.
Answer
For a systematic linear block code, and , with . A codeword is , and for a received vector the syndrome is . All arithmetic is modulo 2.
a) Generator matrix
Transposing:
b) Codeword for message 110
Parity bits directly: , , .
Codeword = 110 101
Check: : row 1: , row 2: , row 3: . Syndrome , so it is valid.
All codewords (for reference; , corrects 1 error):
| 000 | 000000 | 100 | 100110 |
| 001 | 001101 | 101 | 101011 |
| 010 | 010011 | 110 | 110101 |
| 011 | 011110 | 111 | 111000 |
c) Check received word 110111
Each syndrome bit is one row of dotted with :
| Row of | Product terms | |
|---|---|---|
| 1 0 1 1 0 0 | 0 | |
| 1 1 0 0 1 0 | 1 | |
| 0 1 1 0 0 1 | 0 |
The syndrome is non-zero, so the received word has an error.
Locating it: equals the 5th column of , so assuming a single error, bit 5 is wrong: .
Answer: as above; codeword for 110 is 110101; received 110111 is in error (syndrome 010), corrected codeword 110101, message 110.
- 2081 Chaitra · 5 marks
Write a short note on trellis diagram of a message 1010 using a ½ rate 3-state memory block convolutional encoder.
Answer
A trellis diagram is a time-expanded state diagram of a convolutional encoder. The encoder states (contents of the memory) are drawn as rows of nodes, time runs left to right, and each branch shows the transition caused by one input bit, labelled with the output bits. Each message traces one path through the trellis; the Viterbi decoder searches the trellis for the closest path.
Assumed encoder ("3-stage register" read as constraint length : present bit plus 2 memory flip-flops, so states), rate 1/2, generators , :
States : a = 00, b = 10, c = 01, d = 11.
Encoding 1010 (with two 0s to flush)
| Input | State before | Output | State after |
|---|---|---|---|
| 1 | a (00) | 11 | b (10) |
| 0 | b (10) | 10 | c (01) |
| 1 | c (01) | 00 | b (10) |
| 0 | b (10) | 10 | c (01) |
| 0 (flush) | c (01) | 11 | a (00) |
| 0 (flush) | a (00) | 00 | a (00) |
Encoded sequence: 11 10 00 10 11 00.
Trellis with the message path
t0 t1 t2 t3 t4 t5 t6
a 00 * o o o o *======*
\ /
\ /
b 10 o * o * o / o o
\ / \ /
\ / \ /
c 01 o o * o * o o
d 11 o o o o o o o
in: 1 0 1 0 0 0
out: 11 10 00 10 11 00
In the full trellis every state has two branches leaving it (input 0 and input 1). After steps the pattern of branches repeats at every stage. The path marked with * (= for a horizontal branch) is the unique path for 1010; any received sequence is decoded by finding the path with minimum Hamming distance.
- 2080 Chaitra · 8 marks
Determine the encoded sequence for the following input message (m₀, m₁, m₂, m₃, m₄) = (1 0 0 1 1) using convolutional encoder having shift registers with three flip flops. Draw state and trellis diagrams.
Answer
Assumption: the encoder is the standard rate-1/2 encoder with a three-stage shift register (present bit and two delay flip-flops, constraint length ) and generator sequences , .
Encoder: g1 = 111, g2 = 101 (K = 3, rate 1/2)
m -->[ m_i ]-->[ m_i-1 ]-->[ m_i-2 ]
| | |
+---(+)----+-----------+---> c1 = mi+mi-1+mi-2
| |
+---(+)----------------+---> c2 = mi+mi-2
output per bit: c1 c2
Encoded sequence
Message , followed by two 0s to return the register to 00.
| 0 | 1 | 0 | 0 | 1 | 1 |
| 1 | 0 | 1 | 0 | 1 | 0 |
| 2 | 0 | 0 | 1 | 1 | 1 |
| 3 | 1 | 0 | 0 | 1 | 1 |
| 4 | 1 | 1 | 0 | 0 | 1 |
| 5 | 0 | 1 | 1 | 0 | 1 |
| 6 | 0 | 0 | 1 | 1 | 1 |
By polynomials: and , which give the same bits.
Encoded sequence: 11 10 11 11 01 01 11
State diagram
State = previous two inputs : a = 00, b = 10, c = 01, d = 11.
| Present state | Input | Output | Next state |
|---|---|---|---|
| a (00) | 0 | 00 | a (00) |
| a (00) | 1 | 11 | b (10) |
| b (10) | 0 | 10 | c (01) |
| b (10) | 1 | 01 | d (11) |
| c (01) | 0 | 11 | a (00) |
| c (01) | 1 | 00 | b (10) |
| d (11) | 0 | 01 | c (01) |
| d (11) | 1 | 10 | d (11) |
+--0/00--+
v |
[ a 00 ]---+
^ \
0/11 | \ 1/11
| v
[ c 01 ]<--0/10--[ b 10 ]
| ----1/00---> |
^ | 1/01
0/01 | v
+-------------[ d 11 ]--+
^ | 1/10
+------+
label = input/output bits
Trellis diagram
t0 t1 t2 t3 t4 t5 t6 t7
a 00 * o o * o o o *
\ / \ /
\ / \ /
b 10 o * o / o * o o / o
\ / \ /
\ / \ /
c 01 o o * o o \ o * o
\ /
\ /
d 11 o o o o o * o o
in: 1 0 0 1 1 0 0
out: 11 10 11 11 01 01 11
At each stage every state has two branches (input 0 and 1) as in the table; the path for 10011 is marked with *. The output read along the path is 11 10 11 11 01 01 11.
- 2079 Chaitra · 2+4+4 marks
Differentiate error-detection and error-correction. Design a convolutional encoder having code-rate of ½. Also, draw the code-tree and trellis diagram for the same assuming any three-bit input.
Answer
Error detection vs error correction
| Point | Error detection | Error correction |
|---|---|---|
| Aim | Only finds that an error occurred | Finds and fixes the error |
| Redundancy | Few check bits (parity, CRC) | More check bits |
| Action on error | Request retransmission (ARQ) | Corrected at receiver (FEC) |
| Capability | Detects errors | Corrects |
| Return channel | Needed | Not needed |
| Examples | Parity, checksum, CRC | Hamming, BCH, convolutional |
Rate-1/2 convolutional encoder (design)
Choose input bit, output bits (), constraint length (two memory flip-flops, 4 states) and generators , .
Encoder: g1 = 111, g2 = 101 (K = 3, rate 1/2)
m -->[ m_i ]-->[ m_i-1 ]-->[ m_i-2 ]
| | |
+---(+)----+-----------+---> c1 = mi+mi-1+mi-2
| |
+---(+)----------------+---> c2 = mi+mi-2
output per bit: c1 c2
A commutator samples then for each input bit, so two bits go out for every bit in.
State = previous two inputs : a = 00, b = 10, c = 01, d = 11.
| Present state | Input | Output | Next state |
|---|---|---|---|
| a (00) | 0 | 00 | a (00) |
| a (00) | 1 | 11 | b (10) |
| b (10) | 0 | 10 | c (01) |
| b (10) | 1 | 01 | d (11) |
| c (01) | 0 | 11 | a (00) |
| c (01) | 1 | 00 | b (10) |
| d (11) | 0 | 01 | c (01) |
| d (11) | 1 | 10 | d (11) |
Code tree (three-bit input)
Upper branch = input 0, lower branch = input 1; labels are outputs.
00 a (000)
00 a ---<
/ 11 b (001)
00 a ---<
/ \ 10 c (010)
/ 11 b ---<
/ 01 d (011)
start<
\ 11 a (100)
\ 10 c ---<
\ / 00 b (101)
11 b ---<
\ 01 c (110)
01 d ---<
10 d (111)
bit: 1 2 3
Read along a path: input 101 gives 11, 10, 00, i.e. root (down 11) to b, (up 10) to c, (down 00) to b.
Trellis diagram, input 101 (plus 00 to flush)
t0 t1 t2 t3 t4 t5
a 00 * o o o o *
\ /
\ /
b 10 o * o * o / o
\ / \ /
\ / \ /
c 01 o o * o * o
d 11 o o o o o o
in: 1 0 1 0 0
out: 11 10 00 10 11
Encoded output for 101: 11 10 00 10 11. Every state in the full trellis has two outgoing branches; after the first two stages the trellis structure repeats.
- 2078 Chaitra · 2+5 marks
Why convolution coder is better than block coder? Determine systematic and non-systematic code vector for a (7,4) cyclic hamming code for message vector {1011} with generator polynomial g(x) = 1 + X + X³.
Answer
Why a convolutional coder is better than a block coder
- It works on a continuous stream, so no need to wait for a full block; encoding delay and buffering are small.
- It has memory: each output depends on several past bits, so redundancy is spread over many bits and burst-like noise is handled better with interleaving.
- Soft-decision Viterbi decoding is easy, giving 2 to 3 dB more coding gain than hard-decision block decoding at the same rate.
- Simple shift-register encoder and good performance at low rates (used in GSM, satellite, Wi-Fi).
(7,4) cyclic Hamming code, , message 1011
Convention (Haykin): message in ascending powers, so
Modulo-2 arithmetic.
Non-systematic:
Non-systematic code vector = 1111111.
Systematic: , with = remainder of .
x^3 + x^2 + x + 1
---------------------------
x^3+x+1 ) x^6 + x^5 + x^3
x^6 + x^4 + x^3
-------------------------
x^5 + x^4
x^5 + x^3 + x^2
-----------------------
x^4 + x^3 + x^2
x^4 + x^2 + x
-------------------
x^3 + x
x^3 + x + 1
-----------------
1
, so parity bits .
Systematic code vector = 100 1011.
Check: , which expands to , so it is a valid codeword.
| Form | Code vector |
|---|---|
| Non-systematic | 1111111 |
| Systematic | 1001011 |
- 2081 Bhadra (CS II) · 2+6 marks
What is the significance of (dmin) minimum hamming distance? Determine the systematic and non-systematic code vector for a (7,4) cyclic code for message vector (m₀, m₁, m₂, m₃) = (1101) for a given generator polynomial g(x) = 1 + x + x².
Answer
Significance of
The minimum Hamming distance is the smallest number of positions in which any two codewords differ (for a linear code, the smallest non-zero codeword weight). It fixes the power of the code:
- Detects up to errors if .
- Corrects up to errors if , i.e. .
For a (7,4) Hamming code : detects 2, corrects 1 error.
Note on the generator polynomial
A generator for a (7,4) cyclic code must have degree and divide . The printed has degree 2 and does not divide , so it is taken as a misprint of the standard .
Message , ascending powers:
Non-systematic code vector
= 1010001
Systematic code vector
Divide by :
x^3
-----------------------
x^3+x+1 ) x^6 + x^4 + x^3
x^6 + x^4 + x^3
---------------
0
Remainder , parity bits .
= 000 1101
This happens because itself equals , so is already a multiple of .
| Form | Code vector | Weight |
|---|---|---|
| Non-systematic | 1010001 | 3 |
| Systematic | 0001101 | 3 |
Both have weight 3, equal to of the code.
- 2081 Bhadra (CS II) · 4 marks
Write a short note on error detection and correction capability of a codeword.
Answer
The error detection and correction capability of a block code depends on its minimum Hamming distance , the smallest number of bit positions in which any two codewords differ. For a linear code, equals the smallest weight of a non-zero codeword.
Detection
If fewer than bits are changed, a codeword cannot turn into another valid codeword, so the error is noticed:
Correction
The decoder chooses the nearest codeword. This is always right if the received word is closer to the sent codeword than to any other, which needs
To correct and also detect errors: .
c1 o----x----x----o c2 d_min = 3
radius t = 1 spheres do not overlap
| Code | Detects | Corrects | |
|---|---|---|---|
| Single parity | 2 | 1 | 0 |
| (7,4) Hamming | 3 | 2 | 1 |
| Repetition (3,1) | 3 | 2 | 1 |
| Extended (8,4) Hamming | 4 | 3 | 1 |
| (5,1) repetition | 5 | 4 | 2 |
Larger needs more redundancy (lower code rate ).
- 2081 Baisakh (CS II) · 7 marks
Prove that (4,3) even parity code is a linear block code and (4,3) odd parity code is not a linear block code.
Answer
A block code is linear if (1) the all-zero word is a codeword and (2) the modulo-2 sum of any two codewords is also a codeword (closure). For binary codes, (2) implies (1) since .
A (4,3) parity code takes 3 message bits and adds one parity bit .
Even parity code is linear
, so every codeword has an even number of 1s:
| Message | Codeword | Message | Codeword |
|---|---|---|---|
| 000 | 0000 | 100 | 1001 |
| 001 | 0011 | 101 | 1010 |
| 010 | 0101 | 110 | 1100 |
| 011 | 0110 | 111 | 1111 |
General proof: let be codewords, with weights both even. Then
where counts positions where both are 1. Even + even − even = even, so the sum is again an even-weight 4-bit word, i.e. a codeword. Also is a codeword.
Equivalently, the code can be generated by a matrix:
and , which is a codeword.
Example: (codeword), (codeword). Hence the (4,3) even parity code is a linear block code.
Odd parity code is not linear
, so every codeword has an odd number of 1s:
| Message | Codeword | Message | Codeword |
|---|---|---|---|
| 000 | 0001 | 100 | 1000 |
| 001 | 0010 | 101 | 1011 |
| 010 | 0100 | 110 | 1101 |
| 011 | 0111 | 111 | 1110 |
- The all-zero word has even weight, so it is not a codeword.
- Closure fails: for odd , is even, so the sum of two codewords always has even weight and is never a codeword. Example: , weight 2, not in the code.
Hence the (4,3) odd parity code is not a linear block code.
- 2076 Chaitra (CS II) · 8 marks
The 1/3 rate convolutional encoder with constraint length equal to 3 has following three generator sequences each of length 3.
(g₀⁽¹⁾, g₁⁽¹⁾, g₂⁽¹⁾) = (0, 1, 1)
(g₀⁽²⁾, g₁⁽²⁾, g₂⁽²⁾) = (1, 0, 1)
(g₀⁽³⁾, g₁⁽³⁾, g₂⁽³⁾) = (1, 1, 0)
Determine the encoded sequence for the following input message (m₀, m₁, m₂, m₃, m₄) = (1 0 0 1 1)
Answer
Rate : each input bit gives 3 output bits. Constraint length , so the register holds . Each output is the modulo-2 convolution of the input with its generator:
With the given generators:
m -->[ m_i ]-->[ m_i-1 ]-->[ m_i-2 ]
| | |
| +----(+)----+------> c1 = mi-1+mi-2
+----------(+)----------+------> c2 = mi+mi-2
+----(+)----+------------------> c3 = mi+mi-1
commutator: c1 c2 c3 per input bit
Encoding
Message , then two 0s () to flush the register. Register starts at 00.
| 0 | 1 | 0 | 0 | 0 | 1 | 1 |
| 1 | 0 | 1 | 0 | 1 | 0 | 1 |
| 2 | 0 | 0 | 1 | 1 | 1 | 0 |
| 3 | 1 | 0 | 0 | 0 | 1 | 1 |
| 4 | 1 | 1 | 0 | 1 | 1 | 0 |
| 5 | 0 | 1 | 1 | 0 | 1 | 1 |
| 6 | 0 | 0 | 1 | 1 | 1 | 0 |
Check by polynomial (transform-domain) method
; , , .
Interleaving the three sequences bit by bit gives the same result.
Encoded sequence: 011 101 110 011 110 011 110 (21 bits; the first 15 bits, 011 101 110 011 110, correspond to the message itself and the last 6 come from flushing.)
- 2075 Chaitra (CS II) · 2+5 marks
Define hamming distance and hamming weight. For a (6,3) code, the parity check matrix is given by H = [1 0 1 _ 0 0; 0 1 1 _ 1 0; 1 1 0 _ 0 1] (as printed, one column of H is blank; it is most likely H = [1 0 1 1 0 0; 0 1 1 0 1 0; 1 1 0 0 0 1]). Determine whether a received code vector 100101 is erroneous.
Answer
Hamming weight
The Hamming weight of a code vector is the number of 1s in it. Example: .
Hamming distance
The Hamming distance between two vectors is the number of positions where they differ, . Example: .
Checking the received vector
The printed has a blank column; it is taken as the standard systematic form :
A received vector is error-free (a valid codeword) if its syndrome is zero.
: the 1s are in positions 1, 4 and 6, so is the mod-2 sum of columns 1, 4 and 6 of :
| Row | Col 1 | Col 4 | Col 6 | Sum |
|---|---|---|---|---|
| 1 | 1 | 1 | 0 | 0 |
| 2 | 0 | 0 | 0 | 0 |
| 3 | 1 | 0 | 1 | 0 |
The syndrome is zero, so 100101 is a valid codeword (not erroneous), assuming no undetectable error pattern.
Check with the generator matrix :
Message 100 gives , exactly the received vector. Message = 100.
(If a syndrome were non-zero, matching it to a column of would locate a single-bit error; this code has .)
- 2075 Asoj (CS II) · 8 marks
The generator polynomial of a (7,4) cyclic code is G(p) = p³ + p + 1. Obtain the code vector for the code in non-systematic and systematic form with message vector 0101.
Answer
A cyclic code is a linear block code in which every cyclic shift of a codeword is also a codeword. An cyclic code is generated by a polynomial of degree that divides :
- Non-systematic encoding: ; message bits are not visible directly in the codeword.
- Systematic encoding: ; the message appears unchanged and the remainder gives the parity bits.
Given , , . Convention: leftmost message bit is the highest power. Message :
All additions are modulo 2.
Non-systematic form
Coefficients from down to :
| 0 | 1 | 0 | 0 | 1 | 1 | 1 |
Non-systematic code vector: 0100111
Systematic form
- Multiply by : .
- Divide by :
p^2
-----------------
p^3+p+1 ) p^5 + p^3
p^5 + p^3 + p^2
---------------------
p^2 <- remainder
- Remainder , so parity bits .
- .
Check: , a multiple of .
Systematic code vector: 0101 100 (message bits, then check bits)
| Form | Code vector |
|---|---|
| Non-systematic | 0100111 |
| Systematic | 0101100 |
- 2074 Chaitra (CS II) · 2+6 marks
Define Hamming distance and Hamming weight. Explain the operation a 1/3 convolutional encoder.
Answer
Hamming weight and distance
- Hamming weight : number of 1s in a code vector. .
- Hamming distance : number of positions in which two vectors differ, . .
The minimum distance of a code decides that it detects and corrects errors.
Rate-1/3 convolutional encoder
A rate-1/3 convolutional encoder produces 3 output bits for every input bit. It uses a shift register of length (constraint length), three modulo-2 adders and a commutator. Example with and generators , , :
m -->[ m_i ]-->[ m_i-1 ]-->[ m_i-2 ]
| | |
+-----------------------------> c1 = mi
+----------(+)----------+-----> c2 = mi+mi-2
+----(+)----+----(+)----+-----> c3 = mi+mi-1+mi-2
commutator reads c1, c2, c3 in turn
Operation:
- The register starts cleared (00).
- A message bit enters stage 1; older bits shift right.
- Each adder forms the mod-2 sum of the stages connected to it (taps given by its generator).
- The commutator sends , so the output rate is three times the input rate ().
- After the message, zeros flush the register back to 00.
Example: input 101
| Register | ||
|---|---|---|
| 1 | 1 0 0 | 111 |
| 0 | 0 1 0 | 001 |
| 1 | 1 0 1 | 100 |
| 0 (flush) | 0 1 0 | 001 |
| 0 (flush) | 0 0 1 | 011 |
Output: 111 001 100 001 011.
The encoder has states; its behaviour can be shown by a code tree, state diagram or trellis, and it is decoded with the Viterbi algorithm. The low rate gives a large free distance and strong error correction, at the cost of three times the bandwidth.
- 2073 Shrawan (CS II) · 3+4 marks
Define Hamming weight and Hamming distance with examples. Validate the code if received code vector code is [100011] given that H = [1 0 1 1 0 0; 0 1 1 0 1 0; 1 1 0 0 0 1].
Answer
Hamming weight
The Hamming weight is the number of non-zero elements in a code vector.
Example: , .
Hamming distance
The Hamming distance is the number of positions in which two code vectors differ, .
Example: , , , so .
Validating the received vector
A received vector is a valid codeword only if the syndrome .
The 1s of are at positions 1, 5, 6, so add columns 1, 5 and 6 of :
| Row | Col 1 | Col 5 | Col 6 | Sum (mod 2) |
|---|---|---|---|---|
| 1 | 1 | 0 | 0 | 1 |
| 2 | 0 | 1 | 0 | 1 |
| 3 | 1 | 0 | 1 | 0 |
The received vector 100011 is not a valid codeword; it contains an error.
Correction (single error)
The syndrome matches column 3 of , so the 3rd bit is in error: .
Check: columns 1, 3, 5, 6 sum to , so 101011 is valid. Corrected message (first 3 bits): 101.
- 2073 Chaitra (CS II) · 2+6 marks
Why convolution coder are better suited than block coder? Determine systematic and non-systematic code vector for a (7,4) cyclic hamming code for message vector {1010} with generator polynomial g(x) = 1 + x + x³
Answer
Why convolutional coders are better suited than block coders
- Continuous operation: they encode a serial bit stream directly; block coders must wait for bits, adding delay and buffering.
- Memory: each output depends on the present and previous bits, so redundancy is spread over a long span, giving good performance against random noise.
- Soft-decision decoding: the Viterbi algorithm easily uses soft (analog) values, giving about 2 dB extra gain, which is hard for algebraic block decoders.
- Simple hardware: shift registers and XOR gates; widely used in satellite, GSM and Wi-Fi links.
(7,4) cyclic Hamming code, , message 1010
Convention (Haykin): , ascending powers:
Non-systematic:
= 1110010
Systematic:
- Divide by :
x^2
------------------
x^3+x+1 ) x^5 + x^3
x^5 + x^3 + x^2
---------------------
x^2 <- remainder
- , parity bits .
- .
= 001 1010
Check: , divisible by , so valid.
| Form | Code vector |
|---|---|
| Non-systematic | 1110010 |
| Systematic | 0011010 |
- 2072 Kartik (CS II) · 6 marks
Explain Convolutional Coder with suitable example.
Answer
A convolutional coder is a forward error-correcting encoder with memory. It passes the message bits through a shift register and forms output bits as modulo-2 sums of selected stages, so each output depends on the present bit and the previous bits. With inputs and outputs per step, the code rate is ; is the constraint length.
Example: rate 1/2, K = 3
Generators , :
Encoder: g1 = 111, g2 = 101 (K = 3, rate 1/2)
m -->[ m_i ]-->[ m_i-1 ]-->[ m_i-2 ]
| | |
+---(+)----+-----------+---> c1 = mi+mi-1+mi-2
| |
+---(+)----------------+---> c2 = mi+mi-2
output per bit: c1 c2
Encoding message (plus 00 to flush):
| before | ||
|---|---|---|
| 1 | 00 | 11 |
| 0 | 10 | 10 |
| 0 | 01 | 11 |
| 1 | 00 | 11 |
| 1 | 10 | 01 |
| 0 | 11 | 01 |
| 0 | 01 | 11 |
Output: 11 10 11 11 01 01 11.
Representations
- Code tree: each input bit splits a branch (up = 0, down = 1), labelled with output bits.
- State diagram: 4 states (a = 00, b = 10, c = 01, d = 11), e.g. a goes to b with output 11 on input 1.
- Trellis: the state diagram drawn over time; used by the decoder.
Decoding
The Viterbi algorithm compares the received sequence with every trellis path, keeps the best (minimum distance) path into each state, and outputs the survivor; it is a maximum-likelihood decoder. The free distance of this code is , so it can correct 2 errors within a short span.
- 2071 Shrawan (CS II) · 2+5 marks
What is the importance of hamming distance and hamming weight in coding theory? Explain with example the syndrome decoding method in linear block coding.
Answer
Importance of Hamming distance and weight
- Hamming weight (number of 1s) and Hamming distance (number of differing positions) measure how far codewords are apart.
- For a linear code, minimum distance = minimum non-zero weight, so it is found easily.
- fixes the power of the code: detects errors and corrects .
- Decoders choose the codeword at minimum Hamming distance from the received word (maximum-likelihood for a binary symmetric channel).
Syndrome decoding in linear block codes
For a code with generator and parity-check matrix , every codeword satisfies . A received word is , where is the error pattern. The syndrome is
so it depends only on the error, not on the sent codeword.
Steps:
- Compute .
- If , accept as the codeword.
- Otherwise look up the coset leader (most likely error pattern, usually single-bit) with that syndrome; for a single error in bit , equals the -th column of .
- Correct: .
Example: (6,3) code
Syndrome table (single errors):
| Error pattern | Syndrome |
|---|---|
| 000000 | 000 |
| 100000 | 101 |
| 010000 | 011 |
| 001000 | 110 |
| 000100 | 100 |
| 000010 | 010 |
| 000001 | 001 |
Message 101 gives codeword . Suppose (bit 3 flipped).
From the table, , so , message 101 recovered.
- 2070 Asar (CS II) · 2 marks
Define Hamming Weight and Hamming Distance.
Answer
- Hamming weight : the number of non-zero (1) bits in a code vector. Example: .
- Hamming distance : the number of bit positions in which two code vectors of the same length differ; . Example: , ; , so .
The smallest distance between any pair of codewords, , sets the error capability: a code detects errors and corrects errors.
- 2070 Chaitra (CS II) · 6 marks
The generator polynomial of a (7,4) cyclic code is g(x) = 1 + x + x³. Find the code for the message vector 1011 in a non-systematic and systematic form.
Answer
A cyclic code is a linear block code in which every cyclic shift of a codeword is also a codeword. An cyclic code is generated by a polynomial of degree that divides :
- Non-systematic encoding: ; message bits are not visible directly in the codeword.
- Systematic encoding: ; the message appears unchanged and the remainder gives the parity bits.
Given , , . Convention (Haykin): message in ascending powers of :
All arithmetic is modulo 2.
Non-systematic form
( appears three times, leaving .)
Non-systematic code vector = 1111111
Systematic form
- Divide by :
x^3 + x^2 + x + 1
---------------------------
x^3+x+1 ) x^6 + x^5 + x^3
x^6 + x^4 + x^3
-------------------------
x^5 + x^4
x^5 + x^3 + x^2
-----------------------
x^4 + x^3 + x^2
x^4 + x^2 + x
-------------------
x^3 + x
x^3 + x + 1
-----------------
1
- Remainder , parity bits .
- .
Check: quotient . Valid.
Systematic code vector = 100 1011
| Form | Code vector |
|---|---|
| Non-systematic | 1111111 |
| Systematic | 1001011 |
- 2069 Chaitra (CS II) · 4 marks
Write a short note on syndrome calculation in linear systematic block code.
Answer
In a linear systematic block code, and the parity-check matrix is , so every codeword obeys . The syndrome of a received vector is the -bit vector
Properties
- Writing : , i.e. it depends only on the error pattern.
- : no detectable error. : error present.
- For a single error in bit , = -th column of , so the error is located directly.
- All error patterns in one coset of the standard array share one syndrome; the coset leader is taken as the error.
Calculation
In systematic form, = (parity bits recomputed from the received message bits) (received parity bits).
r = [ received msg | received parity ]
| |
[recompute parity] |
| |
+------(XOR)------+--> syndrome s
Example, code with and :
This equals column 3, so bit 3 is wrong; corrected word 101011. For cyclic codes, the syndrome is the remainder of , computed with a shift register.
Questions from Old Question Collection (BEI EX 656) (BEI Communication Systems (EX 656) exam papers, 2078 to 2081 Chaitra), Communication System I (EX 652) (BEX Communication System I (EX 652) papers 2064 to 2080, plus two old BCT Communication Systems papers (2068, 2071)) and Communication System II (EX 702) (BEX Communication System II (EX 702) exam papers, 2069 to 2081). Answers are written for this site; check them against your class notes.
Chapter titles and hours from the IOE syllabus ↗