フィルターのクリア

Add initial conditions when using laplace function

6 ビュー (過去 30 日間)
Bright
Bright 2023 年 11 月 6 日
編集済み: Star Strider 2023 年 11 月 6 日
I want to add the initial conditions x1(0) = 0, x2(0) = 0, diff(x1,t)|0 = 0 and diff(x2,0)|0 = 0 to the laplace transform lap1 and lap2.
syms M2 K2 B2 x2(t) M1 B1 x1(t) f(t)
%considering mass M1 only
eqn1 = M1 * diff(x1,t,2) + B1 * diff(x1,t) + B2*(diff(x1,t) - diff(x2,t)) == f(t);
%considering mass M2 only
eqn2 = M2 * diff(x2,t,2) + B2*(diff(x2,t) - diff(x1,t)) == 0;
Taking laplace of both equation
lap1 = laplace(eqn1)
lap1 = 
lap2 = laplace(eqn2)
lap2 = 

採用された回答

Star Strider
Star Strider 2023 年 11 月 6 日
編集済み: Star Strider 2023 年 11 月 6 日
That requires a subs call for each equation. (The sympref call here makes this easier. You can remove it later if desired.)
Try this —
syms M2 K2 B2 x2(t) M1 B1 x1(t) f(t)
sympref('AbbreviateOutput',false); % Optional
%considering mass M1 only
eqn1 = M1 * diff(x1,t,2) + B1 * diff(x1,t) + B2*(diff(x1,t) - diff(x2,t)) == f(t);
%considering mass M2 only
eqn2 = M2 * diff(x2,t,2) + B2*(diff(x2,t) - diff(x1,t)) == 0;
lap1 = laplace(eqn1)
lap1 = 
lap1 = subs(lap1, {x1(0), x2(0), subs(diff(x1(t), t), t, 0), subs(diff(x2(t), t), t, 0)}, {0, 0, 0, 0})
lap1 = 
lap2 = laplace(eqn2)
lap2 = 
lap2 = subs(lap2, {x1(0), x2(0), subs(diff(x1(t), t), t, 0), subs(diff(x2(t), t), t, 0)}, {0, 0, 0, 0})
lap2 = 
A while ago, I requested that something similar to the dsolve initial conditions be made part of the laplace call. So far, no changes.
EDIT — Æsthetic improvements.
.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by