FSK SIMULATION USING MATLAB - DCS LAB
Aim: Simulation of FSK modulation and demodulation using MATLAB.
Theory:
Generation of FSK
o In FSK, there are two carriers – one of high frequency and the other one of lower frequency. High waveform is multiplied by high frequency signal and low waveform is multiplied by low frequency waveform, thereby generating FSK signalDemodulation of FSK
o FSK signal has a well defined envelope. Hence envelope detector can be used for demodulation. A decision making circuitry is necessary for message detection.Code:
clcclose all
clear all
fc1=input('Enter the freq of 1st Sine Wave carrier:');
fc2=input('Enter the freq of 2nd Sine Wave carrier:');
fp=input('Enter the freq of Periodic Binary pulse (Message):');
amp=input('Enter the amplitude (For Both Carrier & Binary Pulse Message):');
amp=amp/2;
t=0:0.001:1;
c1=amp.*sin(2*pi*fc1*t);
c2=amp.*sin(2*pi*fc2*t);
subplot(5,1,1);
plot(t,c1)
xlabel('Time')
ylabel('Amplitude')
title('Carrier 1 Wave')
grid on;
subplot(5,1,2)
plot(t,c2)
xlabel('Time')
ylabel('Amplitude')
title('Carrier 2 Wave')
grid on;
m=amp.*square(2*pi*fp*t)+amp;
subplot(5,1,3)
plot(t,m)
xlabel('Time')
ylabel('Amplitude')
title('Binary Message Pulses')
grid on;
for i=0:1000
if m(i+1)==0
mm(i+1)=c2(i+1);
else
mm(i+1)=c1(i+1);
end
end
subplot(5,1,4)
plot(t,mm)
xlabel('Time')
ylabel('Amplitude')
title('Modulated Wave')
grid on;
for i=1:1000;
dm(i+1)=c2(i+1)-mm(i+1);
if dm(i+1)==0;
m1(i+1)=1;
else
m1(i+1)=0;
end
end
subplot(5,1,5)
plot(t,m1)
xlabel('Time')
ylabel('Amplitude')
title('Demodulated Wave')
grid on;
Generated Graph:
Enter the freq of 1st Sine Wave carrier:20Enter the freq of 2nd Sine Wave carrier:10
Enter the freq of Periodic Binary pulse (Message):5
Enter the amplitude (For Both Carrier & Binary Pulse Message):4
Comments
Post a Comment