FSK Modulation and Demodulation

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Fsk Modulation and Demodulation

clc
clear all
close all
x=[1 0 1 0]
t=0:0.01:length(x)-0.01
display(length(x))
y=[]
j=1
for i=1:length(t)
if t(i)<j
y(i)=x(j)
else
j=j+1;
y(i)=x(j)
end
end
f1=5;
c1=sin(2*pi*f1*t);
f2=10;
c2=sin(2*pi*f2*t);
FSK=[];
for i=1:length(t)
if y(i)==1
FSK(i)=c1(i)

else
FSK(i)=c2(i)
end
end
for i=1:length(FSK)
if FSK(i)==c1(i)
z(i)=1;

else
z(i)=0;
end
end
subplot(5,1,1)
plot(t,y)
subplot(5,1,2)
plot(t,c1)
subplot(5,1,3)
plot(t,c2)
subplot(5,1,4)
plot(t,FSK)
subplot(5,1,5)
plot(t,z)
%xlabel('time')
%ylabel('amplitude')
%title('message signal')
%subplot(4,1,2)
%plot(t,c1)
%xlabel('time')
%ylabel('amplitude')
%title('ask signal')
%subplot(4,1,3)
%plot(t,ASK)
%xlabel('time');
%ylabel('amplitude');
%title('ASK signal');
%subplot(4,1,4);
%plot(t,z);
%xlabel('time');
%ylabel('amplitude');
%title('ASK signal');

You might also like