0% found this document useful (0 votes)
504 views3 pages

Cyclic Encoding & Decoding

The document describes a MATLAB program for cyclic encoding and decoding. The program takes in binary data as input, performs XOR operations to generate parity bits and append them to create an encoded codeword. It then takes a received codeword as input, calculates the syndrome bits, and uses the syndrome values to detect and correct any errors in the received codeword by flipping the correct bit. The program outputs the syndrome bits, encoded codeword, and corrected codeword if an error was detected.

Uploaded by

Rasool Reddy
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
504 views3 pages

Cyclic Encoding & Decoding

The document describes a MATLAB program for cyclic encoding and decoding. The program takes in binary data as input, performs XOR operations to generate parity bits and append them to create an encoded codeword. It then takes a received codeword as input, calculates the syndrome bits, and uses the syndrome values to detect and correct any errors in the received codeword by flipping the correct bit. The program outputs the syndrome bits, encoded codeword, and corrected codeword if an error was detected.

Uploaded by

Rasool Reddy
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 3

Cyclic Encoding & Decoding

Aim: To develop cyclic code program using MATLAB


Software Required:
1) MATLAB software system
2) keyboard
3) mouse
Algorithm:
1. Start
2. Clear & close all the work space initially
3. Specify the input data
4. For specified i/p waveform the xor operation for the inputs as per the encoder
5. The obtained parity bits must be contained with the input binary data to form encoder
6. Also specify the arthemetic operation for detecting the error in any code vector generator
7. If the syndrome is [0 0 0] then it specifies that code vector doesnt contain any error
8. Else if syndrome is other than [0 0 0 ] then it indicates that the code vector contains error in
any one of the bit
9. Specify the positions of errors by using the syndrome
10. The code vector can be inverted and re-correct the code word
11. Stop

Program:
clc;
m=input('enter binary data');
c=[0 0 0];
d=[0 0 0];
l=length(m);
for i=1:1:l;
c(1)=xor(d(3),m(l+1-i));
c(2)=xor(d(1),c(1));
c(3)=d(2);
d=c;
end;
c=[d m];
disp('syndrome bits are');
disp(d);
fprintf('\n');
disp('code word is');
disp(c);
r=input('enter recieved code word');
w=length(r);
n=[0 0 0];
p=[0 0 0];
for i=1:1:w
n(1)=xor(p(3),r(w+1-i));
n(2)=xor(p(1),p(3));
n(3)=p(2);
p=n;
end;
disp('syndrome bits are');
disp(p);
if p==[0 0 0]
disp('no error in r');
elseif p==[1 0 0]
r(1)=not(r(1));
disp('error in 1st bit of code word');
disp('correct code word in r');
disp(r);
elseif p==[0 1 0]
r(2)=not(r(2));
disp('error in 2nd bit of code word');
disp('correct code word in r');
disp(r);
elseif p==[0 0 1]
r(3)=not(r(3));
disp('error in 3rd bit of code word');
disp('correct code word in r');
disp(r);
elseif p==[1 1 0]
r(4)=not(r(4));
disp('error in 4th bit of code word');
disp('correct code word in r');
disp(r);
elseif p==[0 1 1]
r(5)=not(r(5));
disp('error in 5th bit of code word');

disp('correct code
disp(r);
elseif p==[1 1 1]
r(6)=not(r(6));
disp('error in 6th
disp('correct code
disp(r);
elseif p==[1 0 1]
r(7)=not(r(7));
disp('error in 7th
disp('correct code
disp(r);
end;

word in r');

bit of code word');


word in r');

bit of code word');


word in r');

Result:
For cyclic encoding and decoding the matlab program is performed.

You might also like