Add initial conditions when using laplace function

9 Ansichten (letzte 30 Tage)
Bright
Bright am 6 Nov. 2023
Bearbeitet: Star Strider am 6 Nov. 2023
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 = 

Akzeptierte Antwort

Star Strider
Star Strider am 6 Nov. 2023
Bearbeitet: Star Strider am 6 Nov. 2023
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.
.

Weitere Antworten (0)

Kategorien

Mehr zu Particle & Nuclear Physics finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by