response_time.m
来自「经典《信号与系统》教程的matlab例程,对深入理解信号与系统相关概念有很大帮助」· M 代码 · 共 25 行
M
25 行
close all,clear;
t=0:0.01:20;
w=-5*pi:0.1:5*pi;
x=exp(-abs(t-10));
num=[1 1];
den=[1 2 2];
[A,B,C,D]=tf2ss(num,den);
h=impulse(num,den,t);
y=lsim(A,B,C,D,x,t);
H=freqs(num,den,w);
phase=angle(H);
subplot(221)
plot(t,h);title('The impulse response h(t)'),grid on;
subplot(223)
plot(t,y);title('The output response y(t)'),grid on;
xlabel('Time sec')
subplot(222)
plot(w,abs(H));title('The magnitude response |H(jw)|'),grid on;
subplot(224)
%plot(w,phase);title('The phase response <H(jw)'),grid on;
%xlabel('Frequency in radians/s')
t=-10:0.01:10;
x=0.4*exp(-t).*cos(t).*u(t)+0.8*exp(-t).*sin(t).*u(t)+0.4*exp(t).*u(-t);
plot(t,x)
grid on
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?