📄 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 + -