Simulated Output Full
Simulated Output Full
Simulated Output Full
PROGRAM:
Clc;
Clf;
Clear all;
N=0:1:39
Y1=2*sin(2*pi*2*n/40);
Subplot(3,2,1);
Plot (yl);
Xlabel(‘time (sec)’);
Ylabel(‘amplitude (v)’);
Y2=n*0;
Subplot(3,2,2);
Plot (y2);
Xlabel(‘time (sec)’);
Ylabel(‘amplitude (v)’);
grid;
Subplot(3,2,3);
Xlabel(‘time (sec)’);
Stem(x);
grid;
% ask waveform
Z=0;
For i=1:10;
If(x(i)==1);
Z=[z yi];
Else
Z=[z y2);
End;
End;
Subplot (3,2,4);
Plot(z);
Title(‘ask waveform’);
Xlabel(‘time (sec)’);
Ylabel(‘amplitude (v)’);
% decoded signal
K=1;
For i=1:401;
B(i)=z (i)*y1(k);
K=k+1;
If(k>40)
K=1;
End;
End;
A=0; r=1;g=1;m=40;
for j=1:10;
for i=g:m-1;
a=a+b(i);
end;
if(a>0)
p(r)=1;
else
p(r) =-1;
end;
a=0;r=r+l;g=g+40;m=m+40;
end;
subplot(3,2,5);
stem(p);
title('decoded signal');
xlabel('time (sec)');
ylabel('amplitude (v)');
grid;
FREQUENCY SHIFT KEYING
PROGRAM:
Clc;
Clf;
Clear all;
N=0:1:39
Yl=2* sin(2*pi*2*n/40);
Subplot(3,2,1);
Plot(yl);
Xlabel(‘time (sec)’);
Ylabel(‘amplitude (v)’);
Subplot(3,2,2);
Plot (y2);
Xlabel(‘time (sec)’);
Ylabel(‘amplitude (v)’);
Subplot(3,2,3);
Xlabel(‘time (sec)’);
Stem (x);
Grid;
% fsk waveform
Z=0;
For i=1:10;
If(x(i) ==1);
Z=(z y1);
Else
Z=(z y2);
End;
End;
Subplot(3,2,4);
Plot(z);
Title(‘fsk waveform’);
Xlabel(‘time (sec)’);
Ylabel(‘amplitude (v)’);
% decoded signal
K=1;
For i=1:401;
B(i)=z (i)*y1(k);
K=k+1;
If (k>40)
K=1;
End;
End;
A=0;r=1;971;m=40;
For j=1:10;
For i=g:m-1;
a=a+b(i);
end;
if (a>0)
p(r)=1;
else
p(r)=-1;
end;
a=0;r=r+l;g=g+40; m=m+40;
end;
subplot(3,2,5);
stem(p);
title('decoded signal ) ;
xlabel('time (sec)');
grid;
n‹thngenal basis function1
2
0 t£I 20 30 40
time(sec) time(sec)
fsk waveform
i 2
2 4 6 6 10
time(sec)
decoded signal
10 ,
SIMULATION OF BPSK
PROGRAM:
Clc;
Clear all;
N=length(b);
T=0:0.01:n;
X=1:1n+1)*100;
For i=1:n
If(b(i)==0)
u(i)=-1;
Else
u(i)=1;
End
For j=i:0.1:1+1
bw(x(i*100i+1)*100))=
(i); End
End
Bw=bw(100:end);
Sint=sin(2*pi*t);
“st=bw.*sint;
Subplot(3,1,1);
Plot(t,bw);
Xlabel(‘n-’);
Ylabel(‘amplitude ’);
Grid on;
Axis([O n -2 +2]);
Subplot(3,1,2);
Plot(t, sint);
Xlabel(‘time-’);
Ylabel(‘amplitude
’);Title(‘carrier
Axis([On-2 +2]);
Subplot(3,1,3);
Plot(t,st);
Xlabel(‘time’);
Ylabel(‘amplitude –’
Title(‘bpsk wave’);
Grid on;
Axis([On-2 +2]);
SIMULATION GF BPSK
DIFFERENTIAL PHASE SHIFT KEYING
PROGRAM:
close all;
clear all;
clc;
B=[1 0 0 1 0 0 1 1 ];
B not=~B;
count=0;
Dk=[];
if (B(i)==0)
count=count+1;
if (count>1)
Dk (i)=0;
else
Dk (i)=1;
end
else
if (B(i)==1)
Dk (i)=1;
count=0;
end
end
end
Dk_ not=~Dk;
result=[];
result1=[];
result2=[];
resulti=Dk& B;
result2=Dk_not&B_not;
final=[];
final (1)=1;
final (i+1)=result(i);
end
main final=-final;
fs=1000;
n=0:1:39;
y1=2*sin (2*pi*2*n/40);
y2=2* sin(2*-pi*24n/40);
z=0;
z=[z y1];
else
z=[z y2];
end
end
Plot(z);
Xlabel(‘time (t)’);
Ylabel(‘amplitude’);
Grid on
OUTPUT: DIFFERENTIAL PHASE SHIFT KEYING
PHASE SHIFT KEYING
PROGARM:
clc;
clf;
clear all;
n=0:1:39;
yl=2*sin (2*pi*2*n/40);
subplot(3,2,1);
plot(yl);
xlabel('time (sec)');
y2=2*sin (2*pi*2*n/40);
subplot(3,2,2);
plot(y2);
xlabel('time (sec)');
subplot(3,2,3);
ylabel('amp (v)');
stem (x);
grid;
z=0;
for i=1:10;
if (x (i)==1);
z=[z y1];
else
z=[z y2];
end;
end;
subplot(3,2, 4);
plot (z);
title('psk waveform');
xlabel('time (sec)');
for i=1:401;
k=k+1;
if (k>40)
k=1;
end;
end;
a=0;r=1;g=1;m=40;
for j=1:10;
for i=g:m-1;
a=a+b (i);
end;
if (a>0)
p(r)=1;
else
p(r)=-1;
end;
a=0;r=r+1;g=g+40;m=m+40;
end;
subplot(3,2,5);
stem (p);
title('decoded signal')
xlabel('time (sec)');
grid;
OUTPUT: SIMULATION OF PSK
SIGNAL CONSTELLATION OF QPSK
PROGRAM:
Clc;
Clear all;
Close all;
Data=[0010011 1];
Figure(1)
Stem(data,’linewidth’,3);
Grid on;
Axis([0 11 0 1.5]);
Data_NZR=2*data-1;
S_p_data=reshape(data_NZR, 2,length(data)/2);
Br=10^6;
F=br;
T=1/br;
T=T/99:T/99:T;
Y=[];
Y_in=[];
Y_qd=[];
D=zeros(1,length(data)/2);
For i=1:length(data)/2
P=data(2*i);
Imp=data(2*i-1);
Y1=s_p_data(1,1)* cos(2*pi*f*t);
Y2=s_p_data(2*i)* sin(2*pi*f*t);
Y_in=[y_in y1];
Y_qd=[y_qd y2];
Y=[y y1+y2];
If(imp==0)&&(p==0)
D(i)=exp(j*pi/4);
End
If(imp==1)&&(p==0)
D(i)=exp(j*3*pi/4);
End
If(imp==1)&&(p==1)
D(i)=expl*5*pi/4);
End
If(imp==0)&&(p==1)
D(i)=exp(j*7* pi/4);
End
End
Tx_sig=y
qpsk=d
tt=T/99:T/99T*length(data))/2;
Figure(2)
Subplot(3,1,1);
Plot(tt,y_in, ‘linewidth’,3);
Grid on;
Xlabel(‘time(sec)’);
Ylabel(‘amplitude (volto)’);
Subplot(3,1,2);
Plot(tt,y_qd,’linewidth’,3);
Grid on;
Xlabel(‘time(sec)’);
Ylabel(‘amplitude(volto)’);
Subplot(3,1,3);
Grid on;
Xlabel(‘time(sec)’);
Ylabel(‘amplitude(volto)’);
Figure(3)
Plot(d,’o’);
Axis([-22-22]);
Grid on;
Xlabel(‘real’);
Ylabel(“img”);
Title(‘qpsk constellation’);
OL ITPLIT :
on
x 10 6
SIGNAL CO NSTELLATI ON OF QPSK
OBSERVATION OF SIGNAL CONSTELLATION OF QPM
PROGRAM:
Clc;
Clear all;
N=32;
M=4;
No_of_rows=n/2;
No_of_bits_in_symbol=2;
Data in=randint(1,n);
Len_data_in=length (data_in);
Size (data_instp);
Data_in_sym=bi2 de (data_instp);
Stem (data_in_sym);
Mod_data=qammod (data_in_sym,M);
OUTPUT:
ERROR CONTROL CODING SCHEMES
PROGRAM:
clc;
clear all;
close all. ;
disp (g);
disp('n=b');
disp (n);
disp('k=3');
disp (k);
for i=1:24k;
for j=k:-1:1;
u(i, j)=1;
else
u(i, j)=0;
end;
end;
end;
disp('c=');
disp('the minimum hamming distance dmin for given block code is=');
disp('d_min=');
disp (d_min);
disp('r=');
disp (r);
p=[g(:,n-k+1:n)];
disp('hamming code');
ht=transpose (h);
disp('ht=');
disp (ht);
disp(s);
r(i)=1-r(i);102;
break;
end;
end;
disp('i=');
disp (i);
disp('r=');
disp (r);
OUTPUT:
1 0 0 1 0 1
0 1 0 1 1 0
0 0 1 1 1 1
N=b
K=3
C=
The minimum haming distance dmin for given block code is=
D_min=3
R=
111101
Hamming code
Ht=
1 0 1
1 1 0
1 1 1
1 0 0
0 1 0
0 0 1
S=
001
I=
R=
111100
>>
CYCLIC BLOCK CODES
PROGRAM:
Clc;
Clear all;
N=7;
K=4;
Disp(‘message bit’);
Msg=randint(2,k, [0,1]);
Disp (msg);
Disp(‘cyclic polynomial’);
Pol=cyclpoly(n,k, ‘min’);
Disp (pol);
Disp(‘code vector’);
Disp (code);
Disp € ;
Disp(‘received matrix’);
Disp ® ;
Disp (newmsg);
CYCLIC BLOCK CODES
OUTPUT:
Message bit:
1 1 1 0
0 0 10
Cyclic polynomial
1011
Code vector
1 0 0 1 1 1 0
1 1 0 0 0 1 0
0000000
0 0 0 0 0 00
Received matrix
100111 0
1 1 0 0 0 1 0
1110
0010
SIMULATION OF COLTVOLUTION SCHEMES
PROGRAM:
Clc;
Disp(t);
Disp ©;
%decoding
Opmode=’trunc’;
Detype=’hard’ ;
R=input(‘enter received/code’);
Disp (deco);
Code
SIMULATION OF CONVOLUTION SCHEMES
OUTPUT:
Enter impulse 7
numInputSymbols:2
numOutputSymbols:4
numStates:[4x2 double]
outputs:[4x2 double]
1101001010
10110
>>
COMMUNICTION LINKED SIMULATION
PROGRAM:
clc;
clear all;
close all;
A=5;
fa=50;T=1/fa;
t=0: T/1000:2*T;
ya=3*sin (2*pi*fa*t);
figure (1);
subplot(3,1,1);
plot(t, ya);
title('modulating signal');
xlabel('time (sec)');
ylabel('amp (v)');
A=5;
fc=2000;
yc=A*sin (2*pi*fc*t);
figure (1);
subplot(3,1,2);
plot(t, yc);
title('carrier signal');
xlabel('time (sec)');
figure (1);
subplot(3,1,3);
plot(t, ym);
title('modulating signal');
xlabel('time (sec)');
ylabel('amp (v)');
ym=tA+ya).*sin (2*pi*fc*t);
figure (2);
subplot (4,1,1);
plot(t, ym);
title('received signal');
xlabel('time (sec)');
ylabel('amp (v)');
A=5;
fc=2000;
yo=A* sin(2*pi*fct);
figure (2);
subplot (4,1,2)
plot(t,yc);
title('carrier signal');
xlabel('time (sec)');
ylabel('amp (v)');
figure (2);
subplot(4,1,3);
plot(t, ymm);
xlabel('time (sec)');
ylabel('amp (v)');
wc=200/50000;
figure (2);
subplot(4,1, 4);
plot(t, 2*sig-5);
xlabel('time (sec)');
OOS
EQUALIZATION
PROGRAM:
clear all;
close all;
hold off ;
sysorder=5;
N=200;
h=[0.0976;
0.2873;
0.3360;
0.2210;
0.0964;] ;
d=y+n;
N=60;
for n=sysorder:N
u=inp (n:-1:n-sysorder+1);
y (n)=w'*u;
if n<20
mu=0.32;
else
mu=0.15;
end
w=w+mu*u*e (n) ;
end
u=inp (n:-1:n-sysorder+1));
y (n)=w'*u;
end
hold on
plot(d) ;
plot(y, 'r');
title('system output').;
xlabel('samples');
figure
xlabel('error vàlue');
figure
plot(h, 'k+');
hold on
plot(w, 'r*');