Shruti01
Member level 3
- Joined
- Apr 14, 2010
- Messages
- 67
- Helped
- 3
- Reputation
- 6
- Reaction score
- 3
- Trophy points
- 1,288
- Location
- Mumbai, India
- Activity points
- 1,941
hello,
I have written a matlab code for fsk modulation...the explanation of my code is first I have generated a random sequence. Then i have compared that with threshold. If the number is greater than or equal to threshold then we assign that number to 1 else we assign the number to 0. Thus we get a binary sequence. If the bit is equal to 1, the frequency fc1 is switched on and when the bit is equal to 0, the frequency fc2 is switched on. Now the fsk signal generated is demodulated by using two bandpass filters that are tuned to frequencies of both carrier's fc1 and fc2.... Can u help me out wid the demodulation part... my code is as follows:
clc;
close all;
clear all;
no_of_bits=1000;
no_of_samples=200;
threshold = 0.5;
snr=[-3:1:20];
Tb = 1; % Bit duration
fc = 3/Tb; % Carrier frequency
t1=linspace(0, 1, no_of_samples);
fc1=cos(2*pi*3000*t1); % Carrier frequency 1
fc2=cos(2*pi*2000*t1); % Carrier frequency 2
A = rand(1,no_of_bits); % Generate a random sequence
for i=1:no_of_bits
if (A(i)>=threshold)
A(i)=1;
else
A(i)=0;
end
d = A(1:no_of_bits); % Binary sequence
for j = 1:length(d)
if d(j)==1
fskmod=fc1;
else
fskmod=fc2;
end
end
I have written a matlab code for fsk modulation...the explanation of my code is first I have generated a random sequence. Then i have compared that with threshold. If the number is greater than or equal to threshold then we assign that number to 1 else we assign the number to 0. Thus we get a binary sequence. If the bit is equal to 1, the frequency fc1 is switched on and when the bit is equal to 0, the frequency fc2 is switched on. Now the fsk signal generated is demodulated by using two bandpass filters that are tuned to frequencies of both carrier's fc1 and fc2.... Can u help me out wid the demodulation part... my code is as follows:
clc;
close all;
clear all;
no_of_bits=1000;
no_of_samples=200;
threshold = 0.5;
snr=[-3:1:20];
Tb = 1; % Bit duration
fc = 3/Tb; % Carrier frequency
t1=linspace(0, 1, no_of_samples);
fc1=cos(2*pi*3000*t1); % Carrier frequency 1
fc2=cos(2*pi*2000*t1); % Carrier frequency 2
A = rand(1,no_of_bits); % Generate a random sequence
for i=1:no_of_bits
if (A(i)>=threshold)
A(i)=1;
else
A(i)=0;
end
d = A(1:no_of_bits); % Binary sequence
for j = 1:length(d)
if d(j)==1
fskmod=fc1;
else
fskmod=fc2;
end
end