Need matlab file for FSK Modulation and Demodulation

Status
Not open for further replies.

abcyin

Full Member level 4
Joined
Apr 15, 2005
Messages
236
Helped
12
Reputation
24
Reaction score
3
Trophy points
1,298
Activity points
2,855
Hi, all

could anyone provide me the matlab file for FSK modulation and demodulation, or any links is also welcome, I would appreciate it.

Thanks in advance.
Best regards
 

Find the matlab code below:

%FSK Modulation
bit = round(rand(1,10)); % bit stream of random 1's and 0's
bitperiod = 0.01; %bit period
fs = 15000; %sampling frequency
fc = [3000 5000]; % carrier frequency
% create the FSK signal
L=length(0bitperiod/1500):bitperiod);
transmitted = zeros(1,L);
for k = 1:length(bit)
f = fc(bit(k) + 1);
transmitted((k-1)*L+1: k*L) =
cos(2*pi*f*(0bitperiod/1500):bitperiod));
%transmitted()=transmitted()+2*randn(size(0.01));
%stem(transmitted);%fsk verified
%y = filter(b,a,transmitted);
end
plot(transmitted);

%FSK Demodulation
demod_output=zeros(1,10);
A=zeros(L,1);
%B=zeros(L,1);
Decision=0;
%Logic_0=0;
A=transpose(cos(2*pi*5000*(0bitperiod/1500):bitperiod))-cos(2*pi*300
0*(0bitperiod/1500):bitperiod)));
%B=transpose(cos(2*pi*5000*(0bitperiod/1500):bitperiod)));
for x = 1:length(bit)
Decision= transmitted((x-1)*L+1: x*L)*A;
%Logic_0= transmitted((x-1)*L+1: x*L)*A;
if Decision>0
demod_output(x)=1;
else
demod_output(x)=0;
end
stem(demod_output);
end
 
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…