Professional Documents
Culture Documents
Practicals
(2016-2017)
Inde
Practical No.1
Aim: W.A.P to generate check sum for given data at transmitter side & detect the error at receiver side.
3
% For transmitter side
Practical No.2
Aim: W.A.P to generate code with the added parity on transmitter side & detect error on receiver side. 7
% For transmitter side
Practical No.3
11
Aim: W.A.P to generate hamming code at the transmitter side & detect error on receiver side.
11
Matlab code :-
11
11
13
Practical No.4
Aim: W.A.P to generate crc for transmitter & receiver.
15
15
15
17
Practical No.5
Aim: W.A.P to generate matlab code for byte stuffing.
19
19
Practical No.1
Aim: W.A.P to generate check sum for given data at transmitter side & detect
the error at receiver side.
Matlab code :% For transmitter side
clc,
clear all,
close all,
a=input('input the data to be transmitted=');
l=length(a);
c=zeros(1,4)
j=1
for (i=1:l/4)
b(i,1:4)=a(1,j:j+3);
j=j+4;
end
for(i=1:l/4)
c=xor(c(1,1:4),b(i,1:4));
end
disp('Data in c= ')
disp(c)
disp('Data to be transmitted= ')
d=[b;c]
j =1
Data in c=1
Data to be transmitted=
1
Practical No.2
Aim: W.A.P to generate code with the added parity on transmitter side &
detect error on receiver side.
Matlab code :% For transmitter side
clc;
clear all;
close all;
a=input('enter data to be transmitted= ');
l=length(a)
p=0
for i=1:l
p=xor(p,a(1,i))
end
disp('parity of entered data=');
disp(p);
disp('data to be transmitted=');
a=[a p];
disp(a)
10
Practical No.3
Aim: W.A.P to generate hamming code at the transmitter side & detect error
on receiver side.
Matlab code :% For transmitter side
clc;
clear all;
close all;
a=input('enter data to be transmitted= ');
k=xor(a(1,4),a(1,2))
r0=xor(k,a(1,3))
l=xor(a(1,2),a(1,3))
r1=xor(l,a(1,1))
m=xor(a(1,1),a(1,3))
r2=xor(m,a(1,4))
disp('codeword to be transmitted=')
data=[a,r2,r1,r0]
11
12
13
14
Practical No.4
Aim: W.A.P to generate crc for transmitter & receiver.
Matlab code :% For transmitter side
clc;
clear all;
close all;
a=input('input data for dividend =');
b=input('input data for divisor =');
l=length(b);
disp(l)
c=zeros(1,(l-1));
e=zeros(1,l);
a1=[a,c]
i=length(a1)
disp(a1)
d=xor(a1(1,1:l),b(1,1:l));
disp(d)
n=length(d)
for (p=1:i-l)
if d(1,2)==0
d=xor([d(1,2:n),a1(1,p+l)],e);
disp(d)
else
d=xor([d(1,2:n),a1(1,p+l)],b);
disp(d)
end
end
disp(d)
disp('data to be transmitted = ')
a=[a,d(1,2:n)]
15
i =11
data to be transmitted =
1
16
close all;
17
18
Practical No.5
Aim: W.A.P to generate matlab code for byte stuffing.
Matlab code :clc;
clear all;
close all;
a=input('enter the ascii data to be transmitted=')
l=length(a)
c=a
for i=1:l
if a(1,i)=='e'&& a(1,i-1)~='e'
b=a(1,i:l)
d=a(1,1:i-1)
a=[d 'e' b]
l=l+1
elseif a(1,i)=='f'&& a(1,i-1)~='e'
b=a(1,i:l)
d=a(1,1:i-1)
a=[d 'e' b]
l=l+1
else
end
end
disp('Data after byte stuffing= ')
disp(a)
19
20