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

1 vue (au cours des 30 derniers jours)
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.

Réponse acceptée

Ameer Hamza
Ameer Hamza le 19 Juin 2020
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
  2 commentaires
Sushil
Sushil le 19 Juin 2020
Thank you, this is way easy than I thought. Really appreciate.
Ameer Hamza
Ameer Hamza le 19 Juin 2020
I am glad to be of help!

Connectez-vous pour commenter.

Plus de réponses (0)

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by