用MATLAB求函数H(jw)=(1-jw)/(1+jw)的单位冲激响应、单位阶跃响应及零状态响应的代码
时间: 2024-05-13 22:18:20 浏览: 58
单位冲激响应的代码:
```matlab
syms t w;
H = (1-j*w)/(1+j*w);
h = ilaplace(H);
h = simplify(h);
t = -5:0.01:5;
h_t = subs(h, t);
plot(t, h_t);
xlabel('t');
ylabel('h(t)');
title('Unit Impulse Response');
```
单位阶跃响应的代码:
```matlab
syms t w;
H = (1-j*w)/(1+j*w);
h = ilaplace(H);
h = simplify(h);
s = 1/2*(heaviside(t) + 1);
y = conv(s, h);
t = -10:0.01:10;
y_t = subs(y, t);
plot(t, y_t(1:length(t)));
xlabel('t');
ylabel('y(t)');
title('Unit Step Response');
```
零状态响应的代码:
```matlab
syms t w;
H = (1-j*w)/(1+j*w);
h = ilaplace(H);
h = simplify(h);
t1 = -5:0.01:0;
t2 = 0:0.01:5;
u1 = 0*t1;
u2 = 1*t2;
u = [u1 u2];
y = conv(u, h);
t = -10:0.01:10;
y_t = subs(y, t);
plot(t, y_t(1:length(t)));
xlabel('t');
ylabel('y(t)');
title('Zero State Response');
```
这三段代码分别用于求解函数H(jw)的单位冲激响应、单位阶跃响应及零状态响应,并将结果进行绘图展示。注意,以上代码需要在 MATLAB 中运行。
阅读全文