Saturday, 19 April 2014

DCS PRACTICAL

Q.program to implement Amplitude shift keying modulation.
I)MODULATION
clc;
clear all;
close all;
m=input('enter the sequence');
fc=input('enter the frequency');
l=length(m);
for k=1:l
    for t=(k-1)*100+1:k*100
        y(t)=m(1,k)*sin(2*pi*fc*t/1000);
        c(t)=sin(2*pi*fc*t/1000);
        %a(t)= m(1,k);
    end
end
subplot(3,2,1)
stairs(m)
subplot(3,2,2)
plot(c)
subplot(3,2,3)
plot(y)
grid on;



II)Demodulation-
clc;
clear all;
close all;
m=input('enter the sequence');
fc=input('enter the frequency');
l=length(m);
for k=1:l
    for t=(k-1)*100+1:k*100;
        y(t)=m(1,k)*sin(2*pi*fc*t/1000);
        c(t)=sin(2*pi*fc*t/1000);
        a=length(y)
if y(t)==0
    z(t)=0;
else z(t)=1
end
    end

end
subplot(3,2,1)
stairs(m)
subplot(3,2,2)
plot(c)
subplot(3,2,3)
plot(y)
subplot(3,2,4)
plot(z)
grid on;


No comments:

Post a Comment