一、简介
** FSK信号的解调原理**
FSK信号的解调也有非相干和相干两种,FSK信号可以看作是用两个频率源交替传输得到的,所以FSK的接收机由两个并联的ASK接收机组成。
(1)相干解调
相干解调是利用乘法器,输入一路与载频相干的参考信号与载频相乘,通过低通滤波,滤除高频信号,即得原始信号,FSK经过带通滤波之后,可以看作是两路ASK信号,相干检测器组成的原理如下所示:
二、源代码
clear all
close all
i=10;%基带信号码元数
j=5000;
a=round(rand(1,i));%产生随机序列
t=linspace(0,5,j);
f1=10;%载波1频率
f2=5;%载波2频率
fm=i/5;%基带信号频率
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%产生基带信号
st1=t;
for n=1:10
if a(n)<1;
for m=j/i*(n-1)+1:j/i*n
st1(m)=0;
end
else
for m=j/i*(n-1)+1:j/i*n
st1(m)=1;
end
end
end
st2=t;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%基带信号求反
for n=1:j;
if st1(n)>=1;
st2(n)=0;
else
st2(n)=1;
end
end;
figure(1);
subplot(511);
plot(t,st1);
title(‘基带信号‘);
axis([0,5,-1,2]);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%载波信号
s1=cos(2*pi*f1*t)
s2=cos(2*pi*f2*t)
subplot(512),plot(s1);
title(‘载波信号1‘);
subplot(513),plot(s2);
title(‘载波信号2‘);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%调制
F1=st1.*s1;%加入载波1
F2=st2.*s2;%加入载波2
fsk=F1+F2;
subplot(514);
plot(t,fsk);
title(‘2FSK信号‘)%键控法产生的信号在相邻码元之间相位不一定连续
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%相干解调
st1=fsk.*s1;%与载波1相乘
[f,sf1] = T2F(t,st1);%通过低通滤波器
[t,st1] = lpf(f,sf1,2*fm);
st2=fsk.*s2;%与载波2相乘
[f,sf2] = T2F(t,st2);%通过低通滤波器
[t,st2] = lpf(f,sf2,2*fm);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%抽样判决
%脚本文件F2T.m定义了函数F2T,计算信号的反傅立叶变换。
function [t,st]=F2T(f,sf)
%This function calculate the time signal using ifft function for the input
%signal‘s spectrum
df = f(2)-f(1);
Fmx = ( f(end)-f(1) +df);
dt = 1/Fmx;
N = length(sf);
T = dt*N;
%t=-T/2:dt:T/2-dt;
t = 0:dt:T-dt;
sff = fftshift(sf);
st = Fmx*ifft(sff);
function [t,st]=lpf(f,sf,B)
%This function filter an input data using a lowpass filter
%Inputs: f: frequency samples
% sf: input data spectrum samples
% B: lowpass‘s bandwidth with a rectangle lowpass
%Outputs: t: time samples
% st: output data‘s time samples
df = f(2)-f(1);
T = 1/df;
hf = zeros(1,length(f));%全零矩阵
bf = [-floor( B/df ): floor( B/df )] + floor( length(f)/2 );
hf(bf)=1;
yf=hf.*sf;
[t,st]=F2T(f,yf);
st = real(st);