0% found this document useful (0 votes)
34 views

Experiment No 9 (A) Experimental Study of Cyclic Encoder and Decoder

This experiment aims to understand cyclic coding and learn about cyclic encoding and decoding. Cyclic codes use a shift register and modulo-2 adder for efficient encoding. Properties of cyclic codes include linearity and cyclic shifting. The experiment demonstrates encoding of systematic and non-systematic cyclic codes using MATLAB. It generates codewords, shows the generator and parity matrices, and calculates the syndrome and error vector. The conclusion is that this experiment helped learn cyclic code encoding methods.

Uploaded by

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

Experiment No 9 (A) Experimental Study of Cyclic Encoder and Decoder

This experiment aims to understand cyclic coding and learn about cyclic encoding and decoding. Cyclic codes use a shift register and modulo-2 adder for efficient encoding. Properties of cyclic codes include linearity and cyclic shifting. The experiment demonstrates encoding of systematic and non-systematic cyclic codes using MATLAB. It generates codewords, shows the generator and parity matrices, and calculates the syndrome and error vector. The conclusion is that this experiment helped learn cyclic code encoding methods.

Uploaded by

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

Experiment No 9(a)

Experimental Study of Cyclic Encoder and Decoder.


Objectives
The main objectives of this experiment are:

• To understand cyclic coding.


• To learn about cyclic encoding and decoding.

9.1 Theory

9.1.1 Cyclic Code

Cyclic codes are known to be a crucial subcategory of linear coding technique because these
offers efficient encoding and decoding schemes using a shift register. These are used in error
correction as they can check for double or burst errors. Various other important codes like,
Reed Solomon, Golay, Hamming, BCH, etc. can be represented using cyclic codes.Basically,
a shift register and a modulo-2 adder are the two crucial elements considered as building blocks
of cyclic encoding. Using a shift register, encoding can be efficiently performed. The
fundamental elements of shift registers are flip flops (that acts as a storage unit) and input-
output. While the other i.e., a binary adder has two inputs and one output.

Properties of Cyclic Code:

Property 1: Property of Linearity

According to this property, a linear combination of two codewords must be another


codeword.

Property 2: Property of Cyclic Shifting

According to this property, after a right or left shift in the bits of codewords the resultant code
generated must be another codeword.

Generation of Cyclic codes:


Non-Systematic cyclic codes: The procedure of generatng non systematic code is explained
with an example here.
1.Consider the message signal given as:
m = [1110]
Thus,

M(X) = 1*X0 + 1*X1 + 1*X2 + 0*X3


M(X) = X2 + X + 1

with generator polynomial G(X) = X3 + X + 1

1
For non-systematic code, the codeword is given as:

𝐶(𝑥) = 𝑀(𝑥). 𝐺(𝑥)…………………………………………..(9.1)

𝐶(𝑥) = (𝑋 2 + 𝑋 + 1)(𝑋 3 + 𝑋 + 1)

𝐶(𝑥) = (𝑋 5 + 𝑋 3 + 𝑋 2 + 𝑋 4 + 𝑋 2 + 𝑋 + 𝑋 3 + 𝑋 + 1)

Here modulo 2 addition will be performed and in modulo 2 addition, the sum of 2 similar bits
results in 0.

Thus, X3, X2 and X will get cancelled. So,

𝐶(𝑥) = (𝑋 5 + 𝑋 4 + 1)

Hence, from the above codeword polynomial, the codeword will be:

C = [1000110]
From the codeword bits, we can clearly interpret that the encoded codeword contains the
message and parity bits in an intermixed pattern. Thus, is a non- stematic codeword and direct
determination of message bits is not possible.

Systematic cyclic codes:


The polynomial representation may be used with the same generator polynomial G(X) used
in non-Systematic codes. The procedure is explained with an example here.

1. Consider a message signal: m = [1011].So, message polynomial will be: M(X) = 1 + X2 +


X3 and the generator polynomial G(X) = X3 + X + 1

The equation for determining 7 bits codeword for systematic code is given as:

𝐶(𝑋) = 𝑋 𝑛−𝑘 𝑀(𝑋) + 𝑃(𝑋)……………………………..(9.2)

P(X) represents the parity polynomial and is given by:

𝑋 𝑛−𝑘 𝑀(𝑋)
𝑃(𝑋) = 𝑅𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 { }……………………..(9.3)
𝐺(𝑥)

So, to construct the systematic codeword first we have to determined P(X).

Since n= 7 and k = 4.

𝑋 𝑛−𝑘 𝑀(𝑋) 𝑋 7−4 (𝑥 3 +𝑥 2 +1


𝑃(𝑋) = 𝑅𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 { } ={ }
𝐺(𝑥) 𝑥 3 +𝑥+1

𝑋 𝑛−𝑘 𝑀(𝑋) 𝑋 7−4 (𝑥 3 +𝑥 2 +1


𝑃(𝑋) = 𝑅𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 { 𝐺(𝑥)
} ={ 𝑥 3 +𝑥+1
}

2
𝑋 𝑛−𝑘 𝑀(𝑋) 𝑋 3 (𝑥 3 +𝑥 2 +1
𝑃(𝑋) = 𝑅𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 { } ={ }
𝐺(𝑥) 𝑥 3 +𝑥+1

𝑋 𝑛−𝑘 𝑀(𝑋) (𝑥 6 +𝑥 5 +𝑥 3
𝑃(𝑋) = 𝑅𝑒𝑚𝑎𝑖𝑛𝑑𝑒𝑟 𝑜𝑓 { } ={ }
𝐺(𝑥) 𝑥 3 +𝑥+1

Therefore,Calculating this we get remainder 1.Hence,the obtained value of P(X) = 1.Now,


substituting the values in codeword polynomial equation 9.1,

C(X) = X3 (X3 + X2 + 1) + 1
C(X) = 1 + X3 + X5 + X6

So, the codeword for the above code polynomial will be: C = [1001011].

So, here the first 3 bits are parity bits and the last four bits are message bits. And we can
cross-check that we have considered [1011] as the message bits and parity polynomial
remainder was 1 i.e., code [100].Hence, in this way encoding of non-systematic and
systematic codewords is performed.

9.2 Required Apparatus

MATLAB software

9.3 Experimental Analysis

9.3.1 Write code for enoding of systematic cyclic code with using MATLAB.
Solution:
Code:
clc; Parity = [];
clear all; s0 = [0];
close all; s1 = [0 0];
syms x; for l=1:k
in = input('Enter the order of cyclic code: '); d=zeros(1,k);
n = in(1); d(1,l) = 1;
k = in(2);
q = n-k; D= poly2sym(d);
g = input('Enter the generator polynomial of N=(x^q)*D;
order (n-k): '); Nr = sym2poly(N);
G = poly2sym(g); Num = fliplr(Nr);
disp('The Generator Polynomial: '); [Q,p] = gfdeconv(Num,Den);
disp(G); P=fliplr(p);
Den = fliplr(g); s=size(P);
Gen = []; if (size(P)==size(s1))
b = xor(b,(D(i,l)*Gen(l,j))); P=horzcat(s0,P);
end else if(size(P)==size(s0))
c(i,j)=b; P=horzcat(s1,P);
b=0; end

3
end end
end C =[d,P];
disp('All the generated codewords: '); Gen = vertcat(Gen,C);
disp(c); Parity = vertcat(Parity,P);
In = eye(n); end
disp('Error Vector disp('Generator Matrix: ');
Syndrome'); disp(Gen);
syn = [In, Ht]; disp('Parity Matrix: ');
disp(syn); disp(Parity);
Y = input('Enter the message polynomial of
length n: '); Pt = (Parity)';
y = fliplr(Y); Iq = eye(q);
[Qu,s]=gfdeconv(y,Den); H = [Pt, Iq];
if (size(s)==size(s1)) disp('Parity Check matrix is: ');
s = horzcat(s,s0); disp(H);
else if (size(s)==size(s0)) Ht = H';
s = horzcat(s,s1); D = 0:power(2,k)-1;
end D = dec2bin(D)-48;
end b= 0;
disp('Syndrom is: '); for i=1:2^k
S = fliplr(s); for j=1:n
disp(S); for l=1:k
e=zeros(1,n);
for i=1:1:size(Ht)
if(Ht(i,1:q)==S)
e(i) = 1;
break;
end
end
disp('The Error is in bit:')
disp(i);
disp('The Error Vector corresponding to
Syndrome is:');
disp(e);
disp('The corrected Codeword is:');
Codeword=xor(Y,e);
disp(Codeword);

Output:

Enter the order of cyclic code: [7 4]

Enter the generator polynomial of order (n-k): [1 1 1]

The Generator Polynomial: x^2 + x + 1

4
Generator Matrix: All the generated codewords:

1 0 0 0 0 0 1 0 0 0 0 0 0 0

0 1 0 0 0 1 1 0 0 0 1 0 0 1

0 0 1 0 0 1 0 0 0 1 0 0 1 0

0 0 0 1 0 0 1 0 0 1 1 0 1 1

0 1 0 0 0 1 1

Parity Matrix: 0 1 0 1 0 1 0

0 0 1 0 1 1 0 0 0 1

0 1 1 0 1 1 1 0 0 0

0 1 0 1 0 0 0 0 0 1

0 0 1 1 0 0 1 0 0 0

1 0 1 0 0 1 1

Parity Check matrix is: 1 0 1 1 0 1 0

0 0 0 0 1 0 0 1 1 0 0 0 1 0

0 1 1 0 0 1 0 1 1 0 1 0 1 1

1 1 0 1 0 0 1 1 1 1 0 0 0 0

1 1 1 1 0 0 1

5
Error Vector Syndrome
1 0 0 0 0 0 0 0 0 1
0 1 0 0 0 0 0 0 1 1
0 0 1 0 0 0 0 0 1 0
0 0 0 1 0 0 0 0 0 1
0 0 0 0 1 0 0 1 0 0
0 0 0 0 0 1 0 0 1 0
0 0 0 0 0 0 1 0 0 1

9.4 Discussion & Conclusion


Through this experiment,We had seen the cyclic code encoding method of digital
communication in this lab experiment. We had used the MATLAB Simulink software to watch
this experiment. Using MATLAB Simulink software, we created codes utilizing loops to
achieve the intended results in accordance with theoretical concepts. We were able to decode
and encode cyclic code outputs as a result of our efforts. At last, this lab experiment was
completed correctly.

You might also like