M=2;
b=14;
q=20;
num=[1];
G=tf(num,[M b q]);
syms t
F = 2*(heaviside(t)-heaviside(t-2));
T = linspace(0, 3);
sympref('HeavisideAtOrigin', 0);
u = double(subs(F, t, T));
y1 = lsim(G, u, T);
sympref('HeavisideAtOrigin', 1);
u = double(subs(F, t, T));
y2 = lsim(G, u, T);
syms s
y3 = ilaplace(1/(M*s^2 + b*s + q)*(2/s - 2*exp(-2*s)/s),s,t);
y3 = double(subs(y3,t,T)).';
plot(T,y1,T,y2,T,y3,'o')
legend('HeavisdeOrigin = 0','HeavisdeOrigin = 1','exact','Location','South')
引用格式
Sri (2025). Input and output of transfer function in matlab (https://ww2.mathworks.cn/matlabcentral/fileexchange/163926-input-and-output-of-transfer-function-in-matlab), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
创建方式
R2024a
兼容任何版本
平台兼容性
Windows macOS Linux标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!| 版本 | 已发布 | 发行说明 | |
|---|---|---|---|
| 1.0.0 |
