Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4 views

Error Control Code

The document outlines a study on the Bit Error Rate (BER) performance of Linear Block Codes using MATLAB. It includes an algorithm for generating binary random bits, creating codewords, and evaluating error correction capabilities under different Signal-to-Noise Ratios (SNR). The results are visualized in a plot comparing BER with and without error control coding.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Error Control Code

The document outlines a study on the Bit Error Rate (BER) performance of Linear Block Codes using MATLAB. It includes an algorithm for generating binary random bits, creating codewords, and evaluating error correction capabilities under different Signal-to-Noise Ratios (SNR). The results are visualized in a plot comparing BER with and without error control coding.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Error Control Code - Linear Block Codes

Aim:

To study the BER performance of Linear Block Code

Requirements:

MATLAB software,

Desktop Computer

Formula:

Bit error rate = No. of bits in error after detection / No. of bits transmitted

Theory:

Block Diagram:

Algorithm:

1. Generate binary random bits to the desired length


2. Convert them into block of 7 bits to form it as message block
3. Generate generator matrix
4. Multiply the message block with generator matrix and get codeword blocks
5. Convert back codeword blocks into bit stream.
6. Generate noise to yield the required SNR with respect to the energy in the codeword bit stream.
7. Decode the codeword without error detection and correction. Compare the decoded bits with
transmitted and calculate BER without error control
8. Convert the codeword bit stream into blocks again. Apply parity check matrix to calculate
syndrome
9. Identify the respective error pattern and add with codeword to generate error corrected codeword
10. Separate message words and get the output message bit stream. Compare this input message bit
stream and calculate BER with error control
11. Repeat the steps 6-10 for different SNR and plot BER Vs SNR curve with and without error
control coding
Program:

clc; clear all; close all;

n=7; k=4;
blk_nos=2;
Nbits=blk_nos*k; % Number of bits in simulation

snrdB=[0:10];

% P= [ 1 1 0 ; 0 1 1 ; 1 1 1 ; 1 0 1]; % Parity Matrix


P=[ 1 1 1; 1 1 0; 1 0 1; 0 1 1];
In= eye(4); % Identity Matrix
Ink=eye(3);
G=[In,P]; % Generator Matrix
H=[P',Ink ]; % Parity Check Matrix

bs=randint(1, Nbits, 2); % message bit generation


m=reshape(bs, k,[] )'; % Blocking of bits into 4 bits in each block

x=mod( m*G, 2); % Generating Codeword


ct=reshape(x', 1,[]); % Transmitted bit sequence
ctx=ct;
ctx(ct==0)=-1;

%% For error calculation


errpat=[ 0 0 0 0 0 0 0 ;
1000000;
0100000;
0010000;
0001000;
0000100;
0000010;
0 0 0 0 0 0 1 ];
syndrom=errpat*H';

%% Transmitting bits thr AWGN channel

for ii=1:length(snrdB)
snr(ii)=10^(snrdB(ii)/10)
r=awgn(ctx, snr(ii), 'measured');
cr=r;
cr(r>=0)=1;
cr(r<=0)=0;
y=reshape(cr', n, [])';
s=mod( y*H', 2);
e0=[];
for jj=1:blk_nos
for kk=1:2^(n-k)
if(syndrom(kk,:)==s(jj,:))
ro_match=kk;
break;
end
end
e0=[e0; errpat(ro_match,:)];
end
xcat=mod( y+e0, 2); % 1 bit error correction

BER_wo_EC(ii)=length(find(ct~=cr))/length(ct)
BER_with_EC(ii)=length(find(x~=xcat))/length(ct)
end
semilogy(snr, BER_with_EC, 'r*-', snr, BER_wo_EC, 'b-+')
legend('BER_with_EC', 'BER_wo_EC,');
xlabel('SNR (dB)'); ylabel('BER'); title('BER Performance of Linear Block Code');

Observation:

Number of blocks on simulation : 20000;

Number of bits used: 140000

Message word length = 4

Codeword length = 7

Generator Matrix=

Parity Check Matrix =

SNR:

BER (w/o EC):

BER (with EC):

You might also like