?? nbfm.m
字號:
close all,clear;
kp=1;
t0=6;p=0.05;
t=-t0:p:t0;w0=pi;w1=4*pi;
x=cos(w0*t);
b=3;
x1=sin(w0*t);
c=cos(w1*t+b*x1);
subplot(221)
plot(t,x)
axis([-6,6,-1.2,1.2])
title('The modulating signal x(t)')
grid on;
subplot(222)
plot(t,c)
axis([-6,6,-1.2,1.2])
title('The modulated carrier c(t)')
grid on;
%=========================================================================
W1=8*pi; %確定信號的頻率范圍
N=512;
k=-N:N; %對信號的角頻率進行采樣的點數為2N+1點
W=k*W1/N; %計算頻率的采樣間隔
X=c*exp(-j*t'*W)*p; %進行傅里葉數值積分運算(矩陣運算)
X1=abs(X); %求模——幅度譜
phi=57.3*angle(X); %求相位譜
Y=x*exp(-j*t'*W)*p; %進行傅里葉數值積分運算(矩陣運算)
Y1=abs(Y);
%==========================================================================
subplot(223);plot(W/(2*pi),Y1);grid on;
axis([-W1/(2*pi),W1/(2*pi),-0.3*max(Y1),1.1*max(Y1)])
title('The magnitude spectra ');
xlabel('w*2pi (radians/s)');
subplot(224);plot(W/(2*pi),X);grid on;
axis([-W1/(2*pi),W1/(2*pi),-0.3*max(X1),1.1*max(X1)])
title('The magnitude spectra ');
xlabel('w*2pi (radians/s)');
%===========================================================================
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -