0% found this document useful (0 votes)
20 views10 pages

Academic Year: 2018-19 Sem: 2: Systematic Cyclic Code

This document describes an experiment on systematic cyclic codes. It defines a (7,4) cyclic code with generator polynomial g(x)=x^3+x+1. It encodes 15 messages into their respective codewords and finds the minimum hamming distance of 3. It then introduces a single bit error into a codeword and uses the syndrome to determine the error location and produce the corrected codeword.

Uploaded by

rudra_1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views10 pages

Academic Year: 2018-19 Sem: 2: Systematic Cyclic Code

This document describes an experiment on systematic cyclic codes. It defines a (7,4) cyclic code with generator polynomial g(x)=x^3+x+1. It encodes 15 messages into their respective codewords and finds the minimum hamming distance of 3. It then introduces a single bit error into a codeword and uses the syndrome to determine the error location and produce the corrected codeword.

Uploaded by

rudra_1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

PUNE INSTITUTE OF COMPUTER TECHNOLOGY, PUNE - 411043

DEPARTMENT OF ELECTRONICS AND TELECOMMUNICATION


ACADEMIC YEAR : 2018-19 SEM: 2
EXPT. NO. : 5 ROLL NO. : 3855 DATE :
Systematic Cyclic code:
clc;
clear all;
close all;
n=7;
k=4;
display('Number of code bits');
display(n);
display('Number of message bits:');
display(k);
gen=[1 0 1 1];
display('generator polynomial is');
display(gen);
display('In polynomial form:')
display(poly2sym(gen));
p=[1 0 0 0];
d=1:1:15;
D=dec2bin(d);
for i=1:15

out(i,:) = D(i,:)-'0';

end
display('Messages are:');
out

for i=1:15
data(i,:)=poly2sym(out(i,:));
end
display('messages in polynomial form are:')
display(data);
for i=1:15
Se(i,:)=conv(p,out(i,:));

[q(i,:),e(i,:)]=deconv(Se(i,:),gen);
c(i,:)=mod(Se(i,:)+e(i,:),2);
end
display('codewords are:');
c

for i=1:15
C(i,:)=poly2sym(c(i,:));
end
display('codewords in polynomial form are');
display(C);
display('minimum hamming distance:');
d_min = min(sum((c(2:2^4-1,:))'))
display('Error detecting capability td=dmin-1--->');
td=d_min-1
display('Error correcting capability tc=(dmin-1)/2--->');
tc=(d_min-1)/2
EE=eye(7);
display('Error pattern:');
EE

for i=1:7

[o(i,:),l(i,:)]=deconv(EE(i,:),gen);

ITCCN E&TC, PICT, PUNE-43 PAGE NO.:


PUNE INSTITUTE OF COMPUTER TECHNOLOGY, PUNE - 411043
DEPARTMENT OF ELECTRONICS AND TELECOMMUNICATION
ACADEMIC YEAR : 2018-19 SEM: 2
EXPT. NO. : 5 ROLL NO. : 3855 DATE :
end
L=mod(l,2);

for i=1:7

h(i,:)=L(i,5:7);

end

for i=1:7
H(i,:)=poly2sym(h(i,:));
end
disp('syndrome table');
disp(h);
r=input('enter the noisy code:');
disp('Noisy code in polynomial form:');
disp(poly2sym(r));
[qe,S]=deconv(r,gen);
s=mod(S(1,5:7),2);
display(‘Syndrome is:’);
display(s);

if s==[0 0 0]
display('no error')

else
for i=1:7
if s==h(i,:)
display('error is in following bit');
display(i);
display('Corresponding error pattern');
display(EE(i,:));
c_x=mod(r+EE(i,:),2);
display('corrected codeword ----> c(x)=r(x)+e(x) ');
display(c_x);
display('In polynomial form:');

display(poly2sym(c_x));

break ;
end
end
end

ITCCN E&TC, PICT, PUNE-43 PAGE NO.:


PUNE INSTITUTE OF COMPUTER TECHNOLOGY, PUNE - 411043
DEPARTMENT OF ELECTRONICS AND TELECOMMUNICATION
ACADEMIC YEAR : 2018-19 SEM: 2
EXPT. NO. : 5 ROLL NO. : 3855 DATE :
OUTPUT:

Number of code bits

n =

Number of message bits:

k =

generator polynomial is

gen =

1 0 1 1

In polynomial form:

x^3+x+1

Messages are:

ITCCN E&TC, PICT, PUNE-43 PAGE NO.:


PUNE INSTITUTE OF COMPUTER TECHNOLOGY, PUNE - 411043
DEPARTMENT OF ELECTRONICS AND TELECOMMUNICATION
ACADEMIC YEAR : 2018-19 SEM: 2
EXPT. NO. : 5 ROLL NO. : 3855 DATE :

out =

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

messages in polynomial form are:

ITCCN E&TC, PICT, PUNE-43 PAGE NO.:


PUNE INSTITUTE OF COMPUTER TECHNOLOGY, PUNE - 411043
DEPARTMENT OF ELECTRONICS AND TELECOMMUNICATION
ACADEMIC YEAR : 2018-19 SEM: 2
EXPT. NO. : 5 ROLL NO. : 3855 DATE :

data =

x+1

x^2

x^2+1

x^2+x

x^2+x+1

x^3

x^3+1

x^3+x

x^3+x+1

x^3+x^2

x^3+x^2+1

x^3+x^2+x

x^3+x^2+x+1

codewords are:

ITCCN E&TC, PICT, PUNE-43 PAGE NO.:


PUNE INSTITUTE OF COMPUTER TECHNOLOGY, PUNE - 411043
DEPARTMENT OF ELECTRONICS AND TELECOMMUNICATION
ACADEMIC YEAR : 2018-19 SEM: 2
EXPT. NO. : 5 ROLL NO. : 3855 DATE :

c =

0 0 0 1 0 1 1

0 0 1 0 1 1 0

0 0 1 1 1 0 1

0 1 0 0 1 1 1

0 1 0 1 1 0 0

0 1 1 0 0 0 1

0 1 1 1 0 1 0

1 0 0 0 1 0 1

1 0 0 1 1 1 0

1 0 1 0 0 1 1

1 0 1 1 0 0 0

1 1 0 0 0 1 0

1 1 0 1 0 0 1

1 1 1 0 1 0 0

1 1 1 1 1 1 1

codewords in polynomial form are

ITCCN E&TC, PICT, PUNE-43 PAGE NO.:


PUNE INSTITUTE OF COMPUTER TECHNOLOGY, PUNE - 411043
DEPARTMENT OF ELECTRONICS AND TELECOMMUNICATION
ACADEMIC YEAR : 2018-19 SEM: 2
EXPT. NO. : 5 ROLL NO. : 3855 DATE :

C =

x^3+x+1

x^4+x^2+x

x^4+x^3+x^2+1

x^5+x^2+x+1

x^5+x^3+x^2

x^5+x^4+1

x^5+x^4+x^3+x

x^6+x^2+1

x^6+x^3+x^2+x

x^6+x^4+x+1

x^6+x^4+x^3

x^6+x^5+x

x^6+x^5+x^3+1

x^6+x^5+x^4+x^2

x^6+x^5+x^4+x^3+x^2+x+1

minimum hamming distance:

ITCCN E&TC, PICT, PUNE-43 PAGE NO.:


PUNE INSTITUTE OF COMPUTER TECHNOLOGY, PUNE - 411043
DEPARTMENT OF ELECTRONICS AND TELECOMMUNICATION
ACADEMIC YEAR : 2018-19 SEM: 2
EXPT. NO. : 5 ROLL NO. : 3855 DATE :

d_min =

Error detecting capability td=dmin-1--->

td =

Error correcting capability tc=(dmin-1)/2--->

tc =

Error pattern:

ITCCN E&TC, PICT, PUNE-43 PAGE NO.:


PUNE INSTITUTE OF COMPUTER TECHNOLOGY, PUNE - 411043
DEPARTMENT OF ELECTRONICS AND TELECOMMUNICATION
ACADEMIC YEAR : 2018-19 SEM: 2
EXPT. NO. : 5 ROLL NO. : 3855 DATE :

EE =

1 0 0 0 0 0 0

0 1 0 0 0 0 0

0 0 1 0 0 0 0

0 0 0 1 0 0 0

0 0 0 0 1 0 0

0 0 0 0 0 1 0

0 0 0 0 0 0 1

syndrome table

1 0 1

1 1 1

1 1 0

0 1 1

1 0 0

0 1 0

0 0 1

enter the noisy code:[1 0 1 0 0 1 0]

Noisy code in polynomial form:

x^6+x^4+x

Syndrome is:

ITCCN E&TC, PICT, PUNE-43 PAGE NO.:


PUNE INSTITUTE OF COMPUTER TECHNOLOGY, PUNE - 411043
DEPARTMENT OF ELECTRONICS AND TELECOMMUNICATION
ACADEMIC YEAR : 2018-19 SEM: 2
EXPT. NO. : 5 ROLL NO. : 3855 DATE :
s =

0 0 1

error is in following bit

i =

Corresponding error pattern

ans =

0 0 0 0 0 0 1

corrected codeword ----> c(x)=r(x)+e(x)

c_x =

1 0 1 0 0 1 1

In polynomial form:

= x^6+x^4+x+1

ITCCN E&TC, PICT, PUNE-43 PAGE NO.:

You might also like