Simulation of Error Control Codes Using Matlab: EX - NO: Date
Simulation of Error Control Codes Using Matlab: EX - NO: Date
NO:
DATE:
X3
X2
X1
Y3
Y2
Y1
c.Convolutional Encoder Rate 1/2= R convolutional codes with (m, k, n) = (2,1,2) and two generator Sequences are: g1 = (1 0 1) g2 = (1 1 1)
a.LINEAR BLOCK CODES Algorithm Define the block length n and message length k. Define coefficient matrix(P). Generate the generator matrix G=[Ik ; P] Generate codeword C=m.G. From G matrix calculate the H matrix. Calculate syndrome S=r.HT. Identify the error pattern(e). Corrected code word=r + e. Program %%%%%%%%%%% (n,k) linear block code %%%%%%%%%%%% clc; close all;
%p=[1 1 0;0 1 1;1 1 1;1 0 1] p=input('Enter Coefficient matrix'); disp('Generator matrix'); g=[eye(k),[p]]
%Generator matrix
%m=[0 0 0 0;0 0 1 1; 0 1 0 1;1 0 1 1; 1 0 0 1; 1 1 1 1] m=input('Enter the message sequence') disp('Code words'); c=rem(m*g,2) disp('Parity check matrix'); par_che = gen2par(g) trt = syndtable(par_che); %r=[1 1 1 1 0 0 0 ]; r=input('Enter the received sequence'); disp('syndrome'); syn=rem(r*par_che',2) syn_de = bi2de(syn,'left-msb'); disp('Error pattern'); error = trt(1+syn_de,:) disp('Corrected code word'); code1=rem(r+error,2) % Corrected codeword % Error pattern % Convert to decimal %Parity check matrix %Decoding table
Linear Block codes Input Enter n value7 Enter K value4 Enter Coefficient matrix[1 0 1;1 1 1;1 0 0;0 0 1] Enter the message sequence[0 0 0 1; 0 0 1 1;0 1 0 0;1 0 0 0;1 0 1 0; 1 1 1 0; 1 1 1 1]