% 定义微分方程 syms y(t) x(t) eqn = diff(y,t,2) + 3diff(y,t) + 2y == diff(x,t) + 3*x;

% 输入信号 x = exp(-3*t);

% 初始条件 y0 = 1; dy0 = 2;

% 求解微分方程 ySol(t) = dsolve(eqn, y(0)==y0, diff(y)(0)==dy0); ySol = simplify(ySol);

% 零输入响应 zi = subs(ySol, x, 0);

% 零状态响应 zs = subs(ySol, x, int(x));

% 完全响应 zc = subs(ySol, x, x);

% 绘制零输入响应、零状态响应和完全响应 t = 0:0.01:5; zi_t = double(subs(zi, t)); zs_t = double(subs(zs, t)); zc_t = double(subs(zc, t));

figure; plot(t, zi_t, 'r', 'LineWidth', 1.5); hold on; plot(t, zs_t, 'g', 'LineWidth', 1.5); plot(t, zc_t, 'b', 'LineWidth', 1.5); legend('Zero Input Response', 'Zero State Response', 'Complete Response'); xlabel('t'); ylabel('y(t)'); title('Response of the system');


原文地址: https://www.cveoy.top/t/topic/pgLg 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录