假设基带信号为m(t)=sin(2000πt)+2cos(1000πt)+4sin(500πt+π/3),载波频率为20kHz,频偏常数为5kHz/V,仿真产生FM信号,观察波形与频谱。
clear
t1=0.1;
fs=1000000;
ts=1/fs;
t=-t1:ts:t1;
fc=20000;
s=cos(2*pi*fc*t);
figure
plot(t,s);
xlabel('ʱ¼ä');
ylabel('·ù¶È');
title('Ôز¨²¨ÐÎ');
grid on
axis([-0.0001 0.0001 -2 2]);
fm=250;
kf=5000;
x=sin(2*pi*4*fm*t)+2*cos(2*pi*2*fm*t)+4*sin(2*pi*fm*t+pi/3);
figure;
plot(t,x);
grid on
xlabel('t');ylabel('x');
axis([0 0.01 -10 10])
title('µ÷ÖÆÐźŲ¨ÐÎ')
figure
a=fft(x,1024);
f=(0:length(a)-1)*fs/length(a)-fs/2;
plot(f,abs(a));
grid on
xlabel('ffrequence(Hz)');
ylabel('powerspectrum(x)');
axis([-600000 600000 0 300]);
title('µ÷ÖÆÐźÅƵÆ×ͼ');
figure
phi=2*pi*kf*cumsum(x)*ts;
y=cos(2*pi*fc*t+phi);
plot(t,y);
grid on
xlabel('t(s)');ylabel('y');
axis([0 0.01 -5 5]);
b=fft(y,1024);
f=(0:length(b)-1)*fs/length(b)-fs/2;
title('Òѵ÷ÐźŲ¨ÐÎ');
figure
plot(f,abs(b));
grid on