Experiment No.5: Title: Aim: Apparatus: Theory: (1) Explain Linear Block Codes in Detail
Experiment No.5: Title: Aim: Apparatus: Theory: (1) Explain Linear Block Codes in Detail
(2) Explain Generator matrix and Parity check matrix giving their
relation.
s= x*H
(4) Explain with example coding and decoding in LBC.
ENCODING
Hamming discovered a code in which a four-bit message is
represented by a seven-bit codeword. The generator matrix is:
1. Started
2. we Accepted size of LBC block code in terms n and k
3. We Accepted parity p matrix of size k x (n-k)
4. We Generated generator matrix such that G = [Ik | P] Of size k x
n in which Ik is an identity matrix.
5. We Generated parity check matrix such that H= [PT | In-k] Of
size
(n-k) x n in which PT is an transpose of P matrix.
6. We Generated msg. vector
7. We Generated code vector by formula, C = MG
8. We Displaied it
9. We Also calculated hamming weight of each code word and that is
done by calculating total no.of ones in the code vector. Display it.
10. We Calculated detecting capability by Td =dmin- 1 , where dmin
is minimum hamming distance.
11. We Calculated error correcting capability tc by, tc= (dmin-1) /2
12. we Displaied parity matrix H
13. We calculated syndrome vector for 2 different patterns E.S=E.H
14. We Compared this S with each S created for different error
pattern where S is matched error is in that respective bit w.r.t. the
error pattern. Display no. of bits where is there. If S of received
vector is 0 then display received vector is coorect.
Conclusion:
Code:
Program:
clc;
close all;
n=6;
k=3;
p=[0 1 1 ; 1 0 1; 1 1 0]; % Parity Matrix
d=input('enter three bit message=');
ik=eye(k);
g=cat(2,ik,p);
disp('Generator Matrix:');
disp(g);
c1=mtimes(d,g);
c=mod(c1,2);
disp('The codeword for given message is:');
disp(c);
Results