f=5;
f2=10;
x=[0 1 0 1 0 1 1 1] % input signal ;
nx=length(x);
i=1;

while i<nx+1
t = i:0.001:i+1;
if x(i)==1
ask=sin(2pift);
fsk=sin(2pift);
psk=sin(2pift);
else ask=0;
fsk=sin(2pif2t);
psk=sin(2pif*t+pi);
end
subplot(311); plot(t,ask); hold on; grid on; axis([1 10 -1 1]);
title('Amplitude Shift Key')

subplot(312); plot(t,fsk); hold on; grid on; axis([1 10 -1 1]);
title('Frequency Shift Key')

subplot(313); plot(t,psk); hold on; grid on; axis([1 10 -1 1]);
title('Phase Shift Key')

i=i+1;
end

Leave a comment