0% found this document useful (0 votes)
25 views2 pages

All All: For For End End

This document simulates frequency-shift keying (FSK) modulation and demodulation. It generates an input signal, modulates it using FSK with two carrier frequencies, and then demodulates the FSK signal to recover the original input signal. The input signal is a sequence of 1s and 0s. It modulates the signal by generating a cosine carrier at one frequency for 1s and another frequency for 0s. It then demodulates by checking the frequency of each time segment to recover the original 1s and 0s.

Uploaded by

Vikas Sharma
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views2 pages

All All: For For End End

This document simulates frequency-shift keying (FSK) modulation and demodulation. It generates an input signal, modulates it using FSK with two carrier frequencies, and then demodulates the FSK signal to recover the original input signal. The input signal is a sequence of 1s and 0s. It modulates the signal by generating a cosine carrier at one frequency for 1s and another frequency for 0s. It then demodulates by checking the frequency of each time segment to recover the original 1s and 0s.

Uploaded by

Vikas Sharma
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

FSK

clc;
clear all;
close all;
x=[1 0 1 1 0 1];
l=length(x);
fc=20;
fm=80;
for i=1:l
amp=x(1,i);
for t=(i-1)*100+1:i*100
inp(t)=amp;
end
end
subplot(3,1,1);
plot(inp);
title('input signal');
axis([1 t -2 2]);
grid on;
ylabel('amplitude--->');
xlabel('time--->');
%fsk modulation
for i=1:l
amp=x(1,i);
for t=(i-1)*100+1:i*100
if amp==1
freq=fm;
inp(t)=cos(2*pi*freq*t/1000);
else if amp==0
freq=fc;
inp(t)=cos(2*pi*freq*t/1000);
end
end
end
end
subplot(3,1,2);
plot(inp);
title('fsk signal');
axis([1 t -2 2]);
grid on;
ylabel('amplitude--->');
xlabel('time--->');
%fsk demodulation
for i=1:l
if freq==(fm*x(1,i))
for t=(i-1)*100+1:i*100
d(t)=1;
end
else
for t=(i-1)*100+1:i*100
d(t)=0;
end
end
end
subplot(3,1,3);

plot(d);
title('recovered signal');
axis([1 t -2 2]);
grid on;
ylabel('amplitude--->');
xlabel('time--->');

You might also like