COMMUNICATION SYSTEM -1
Error Control Coding
A report for partial fulfillment of academic requirement for the award of degree of
BACHELOR OF ENGINEERING
in
ELECTRONICS & COMMUNICATION ENGINEERING
Under the guidance of
LOKESHA H R
Assistant Professor
Dept. Of Electronics & Communication Engineering
The National Institute of Engineering
Mysuru
Submitted By:
HARSHIT C – 4NI22EC407
ABHIRMA ADHIGA– 4NI21EC002
5th SEM, ‘A’ Section
INTRODUCTION :
Error Control Coding
In coding theory, a linear code is an error-correcting code for which
any linear combination of codewords is also a codeword. Linear
codes are traditionally partitioned into block codes and
convolutional codes, although turbo codes can be seen as a hybrid
of these two types. Linear codes allow for more efficient encoding
and decoding algorithms than other codes. Linear codes are used
in forward error correction and are applied in methods for
transmitting symbols (e.g., bits) on a communications channel so
that, if errors occur in the communication, some errors can be
corrected or detected by the recipient of a message block.
Noise or Error is the main problem in the signal, which disturbs the
reliability of the communication system. Error control coding is the
coding procedure done to control the occurrences of errors. These
techniques help in Error Detection and Error Correction.
There are many different error correcting codes depending upon
the mathematical principles applied to them. But, historically,
these codes have been classified into Linear block codes and
Convolution codes.
Linear Block Codes
In the linear block codes, the parity bits and message bits have a
linear combination, which means that the resultant code word is
the linear combination of any two code words.
Let us consider some blocks of data, which contains k bits in each
block. These bits are mapped with the blocks which has n bits in
each block. Here n is greater than k. The transmitter adds
redundant bits which are n−k bits. The ratio k/n is the code rate. It
is denoted by r and the value of r is r < 1.
The n−k bits added here, are parity bits. Parity bits help in error
detection and error correction, and also in locating the data. In the
data being transmitted, the left most bits of the code word
correspond to the message bits, and the right most bits of the code
word correspond to the parity bits.
Convolution Codes
So far, in the linear codes, we have discussed that systematic
unaltered code is preferred. Here, the data of total n bits if
transmitted, k bits are message bits and n−k
bits are parity bits.
In the process of encoding, the parity bits are subtracted from the
whole data and the message bits are encoded. Now, the parity bits
are again added and the whole data is again encoded.
The following figure quotes an example for blocks of data and
stream of data, used for transmission of information.
The whole process, stated above is tedious which has drawbacks.
The allotment of buffer is a main problem here, when the system is
busy.
This drawback is cleared in convolution codes. Where the whole
stream of data is assigned symbols and then transmitted. As the
data is a stream of bits, there is no need of buffer for storage.
Hamming Codes
The linearity property of the code word is that the sum of two code
words is also a code word. Hamming codes are the type of linear
error correcting codes, which can detect up to two bit errors or they
can correct one bit errors without the detection of uncorrected
errors.
While using the hamming codes, extra parity bits are used to
identify a single bit error. To get from one-bit pattern to the other,
few bits are to be changed in the data. Such number of bits can be
termed as Hamming distance. If the parity has a distance of 2, one-
bit flip can be detected. But this can't be corrected. Also, any two
bit flips cannot be detected.
However, Hamming code is a better procedure than the previously
discussed ones in error detection and correction.
Code:
clc;
clearall;
%g=input('Enter The Generator Matrix: ');
%row value separate by semicolon
disp('The Generator Matrix is : ');
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];
disp(g);
disp ('The Order of Linear Block Code for given Generator
Matrix is:');
[n,k] = size(transpose(g));
disp('The Code Word Length is : ');
disp(n);
disp('The Parity Bit Length is : ');
disp(k);
for i = 1:2^k
for j = k:-1:1
if rem(i-1,2^(-j+k+1))>=2^(-j+k)
m(i,j)=1;
else
m(i,j)=0;
end
end
end
disp('The Possible Message Bits are : ');
disp('
c0
c1
c2
c3');
disp(m);
disp('The Possible Codewords are :')
disp(' b0 b1 b2 c0 c1 c2 c3 Hamming
weight')
c = rem(m*g,2);
d_min = sum((c(1:2^k,:))');
d_min2=d_min';
s= [ c d_min2];
disp(s);
disp('The Minimum Hamming Weight for the given Block Code
is= ');
d_min1 = min(sum((c(2:2^k,:))'));
disp(d_min1);
% DECode
p = [g(:,1:n-k)];
h = [eye(n-k),transpose(p)];
disp('The H Matrix is ');
disp(h);
ht = transpose(h);
disp('The H Transpose Matrix is ');
disp(ht);
r=[0 0 1 1 1 0 1];
e=rem(r*ht,2);
disp('Syndrome of a Given Codeword is :');
disp(e);
for i = 1:1:size(ht)
if(ht(i,1:3)==e)
r(i) = 1-r(i);
break;
end
end
disp('The Error is in bit:');
disp(i);
disp('The Corrected Codeword is :');
disp(r);
OUľPUľ:
ľhe Geneíatoí Matíix is :
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
The Order of Linear Block Code for given Generator Matrix is
The Code Word Length is : 7
The Parity Bit Length is : 4
The Possible Message Bits are :
c0 c1 c2 c3
0 0 0 0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
0 1 0 1
0 1 1 0
0 1 1 1
1 0 0 0
1 0 0 1
1 0 1 0
1 0 1 1
1 1 0 0
1 1 0 1
1 1 1 0
1 1 1 1
The Possible Code word sare :
b0 b1 b2 c0 c1 c2 c3 Hamming weight
0 0 0 0 0 0 0 0
1 0 1 0 0 0 1 3
1 1 1 0 0 1 0 4
0 1 0 0 0 1 1 3
0 1 1 0 1 0 0 3
1 1 0 0 1 0 1 4
1 0 0 0 1 1 0 3
0 0 1 0 1 1 1 4
1 1 0 1 0 0 0 3
0 1 1 1 0 0 1 4
0 0 1 1 0 1 0 3
1 0 0 1 0 1 1 4
1 0 1 1 1 0 0 4
0 0 0 1 1 0 1 3
0 1 0 1 1 1 0 4
1 1 1 1 1 1 1 7
The Minimum Hamming Weight for the given Block Code is = 3
The H Matrix is
1 0 0 1 0 1 1
0 1 0 1 1 1 0
0 0 1 0 1 1 1
The H Transpose Matrix is
1 0 0
0 1 0
0 0 1
1 1 0
0 1 1
1 1 1
1 0 1
Syndrome of a Given Code word is :
0 0 1
The Error is in bit: 3
The Corrected Code word is :
0 0 0 1 1 0 1
Conclusion:
By implementing error control codes,
communication systems can achieve higher data accuracy,
reduce the likelihood of transmission errors, and enhance the
overall quality of service. This is particularly important in
scenarios where data integrity is critical, such as in
telecommunications, data storage, and networking
applications. As technology continues to advance, the
development and deployment of robust error control
mechanisms will remain essential to meet the increasing
demand for reliable and efficient communication systems in
various domains.