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

1 回表示 (過去 30 日間)
Sushil
Sushil 2020 年 6 月 18 日
コメント済み: Ameer Hamza 2020 年 6 月 19 日
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
  2 件のコメント
Sushil
Sushil 2020 年 6 月 19 日
Thank you, this is way easy than I thought. Really appreciate.
Ameer Hamza
Ameer Hamza 2020 年 6 月 19 日
I am glad to be of help!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by