Add initial conditions when using laplace function

9 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Particle & Nuclear Physics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by