📄 dm10202.m
字号:
% dm10202
% 冲激信号的傅里叶变换及频谱分析
syms t w ; %定义符号变量
ut1 = sym('Heaviside(t+0.5)-Heaviside(t-0.5)'); %脉宽为1的矩形脉冲信号
subplot(211);
%绘制矩形脉冲信号
plot([-0.5 0.5],[1 1])
title('脉宽为1的矩形脉冲信号');
xlabel('t');
hold on
plot([-0.5 -0.5],[0 1])
plot([0.5 0.5],[0 1])
axis([-1 1 0 1.1]); %给定座标系的范围
Fw1 = fourier(ut1,t,w); %用函数fourier()对矩形脉冲信号求傅里叶变换
FFw1 = maple('convert',Fw1,'piecewise');
FFP1 = abs(FFw1); %求幅度频谱
subplot(212);
ezplot(FFP1,[-10*pi 10*pi]); %绘制幅度频谱
axis([-10*pi 10*pi 0 1.1]); %给定坐标系的范围
title('脉宽为1的矩形脉冲信号的幅度频谱');
hold on
pause %键盘输入任意键后执行后续程序
ut2 = 10*sym('Heaviside(t+0.05)-Heaviside(t-0.05)'); %脉宽为0.1的矩形脉冲信号,
%为保证它的面积为1,脉宽减为0.1时,幅度增加到10。
subplot(211);
%绘制矩形脉冲信号
plot([-0.05 0.05],[10 10])
plot([-0.05 -0.05],[0 10])
plot([0.05 0.05],[0 10])
axis([-1 1 0 11]); %给定坐标系的范围
title('脉宽为1、0.1的矩形脉冲信号');
xlabel('t');
Fw2 = fourier(ut2,t,w); %用fourier函数对门函数求傅里叶变换
FFw2 = maple('convert',Fw2,'piecewise');
FFP2 = abs(FFw2); %求幅度频谱
subplot(212);
ezplot(FFP2,[-10*pi 10*pi]); %绘制幅度频谱
axis([-10*pi 10*pi 0 1.1]); %给定坐标系的范围
title('脉宽为1、0.1的矩形脉冲信号的幅度频谱');
pause
ut3 = 100*sym('Heaviside(t+0.005)-Heaviside(t-0.005)'); %脉宽为0.01的矩形脉冲信号,%为保证它的面积为1,脉宽减为0.01时,幅度增加到100。
subplot(211);
%绘制矩形脉冲信号
plot([-0.005 0.005],[100 100])
plot([-0.005 -0.005],[0 100])
plot([0.005 0.005],[0 100])
axis([-1 1 0 110]); %给定坐标系的范围
title('脉宽为1、0.1和0.01的矩形脉冲信号');
xlabel('t');
Fw3 = fourier(ut3,t,w); %用fourier函数对门函数求傅里叶变换
FFw3 = maple('convert',Fw3,'piecewise');
FFP3 = abs(FFw3); %求幅度频谱
subplot(212);
ezplot(FFP3,[-10*pi 10*pi]); %绘制幅度频谱
axis([-10*pi 10*pi 0 1.1]); %给定坐标系的范围
title('脉宽为1、0.1和0.01的矩形脉冲信号的幅度频谱');
%End
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -