tran.m

来自「经典《信号与系统》教程的matlab例程,对深入理解信号与系统相关概念有很大帮助」· M 代码 · 共 41 行

M
41
字号
%============================================================
%                 程序名:tran.m
% 设f(t)=(t/4+1)[u(t+2)-u(t-2)]
% 本程序分别画出f(t+t0)、f(t-t0)、f(-t)的波形,
% 同时还给出f(t)在时域中的压缩(a>1)和扩展(a<1)的f(at)的波形
%============================================================
syms t;
f=sym('(t/4+1)*(u(t+2)-u(t-2))');
t0=input('请输入位移量t0=');
a1=input('请输入压缩系数a=');
a2=input('请输入扩展系数a=');
clf;
%画f(t)=(t/4+1)[u(t+2)-u(t-2)]的波形
subplot(3,2,1);
ezplot(f,[-12,12]),grid on;disp('please push any key to continuous'),pause;
% 画f(t)的左移波形
y1=subs(f,t,t+t0);
subplot(3,2,3);
ezplot(y1,[-12,12]),grid on
text(5,1.2,'信号左移');disp('please push any key to continuous'),pause;
%画f(t)的右移波形
y2=subs(f,t,t-t0);
subplot(3,2,5);
ezplot(y2,[-12,12]),grid on;
text(-5,1.2,'信号右移');disp('please push any key to continuous'),pause;
%画f(t)的反褶波形
y3=subs(f,t,-t);
subplot(3,2,2);
ezplot(y3,[-12,12]),grid on;
text(5,1.2,'信号反褶');disp('please push any key to continuous'),pause;
%画f(2t)的波形---波形压缩
y5=subs(f,t,a1*t);
subplot(3,2,4);
ezplot(y5,[-12,12]),grid on;
text(5,1.2,'信号压缩');disp('please push any key to continuous'),pause;
%画f(0.5t)的波形---波形扩展
y6=subs(f,t,a2*t);
subplot(3,2,6);
ezplot(y6,[-12,12]),grid on;
text(5,1.2,'信号扩展');

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?