Matlab Symbolic Maths - How to insert ¨y(t) +˙y(t) +y(t)= f(t) equation in symbolic Maths?

1 次查看(过去 30 天)
I have the above equation which is y''(t) + y'(t) + y(t) =f(t). How can I find the impulse response of this LTI system using symbolic maths? My main concern is how I can put in derviates using syms keyword. Also after I put in this equation ¨y(t) +˙y(t) +y(t)= f(t), I need to find the Laplace transform for the same.
Thanks in advance.

采纳的回答

Ameer Hamza
Ameer Hamza 2020-6-19
Although there are easier ways to solve this equation in MATLAB (e.g., using dsolve()), you mentioned Laplace transform in your question. The following code shows how to use it Laplace, and inverse Laplace transform to find the impulse response.
syms y(t) f(t) Ly
dy = diff(y, 1);
ddy = diff(y, 2);
ic = [0 0]; % initial condition: y(0)=0, y'(0)=0
eq = ddy + dy + y == f; % differential equation
eq_impulse = subs(eq, f(t), dirac(t)); % substitude f(t)=dirac(t) i.e., impulse input
eq_laplace = laplace(eq_impulse); % laplace transform of equation
eq_laplace = subs(eq_laplace, [y(0) dy(0) laplace(y)], [ic Ly]); % substituting initial conditions
Ly = solve(eq_laplace, Ly); % seperating the laplace(y) term
y(t) = ilaplace(Ly); % inverse laplace transform
fplot(y, [0 10]); % plot from t=0 to t=10

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by