Chancing variable in laplace transformation
1 view (last 30 days)
Show older comments
% mass of person and parachute
Mj = 70; % kg
Mp = 25; % kg
% friction cof.
Bj = 13; % N/(m/s)
Bp = 140; % N/(m/s)
syms Xp(t) Xj(t) t s XP(s) XJ(s)
% elastic cons.
k = 400; % N/m
% gravity
g = 9.81; % m/s^2
D1XP=diff(Xp,t);
D2XP=diff(D1XP);
D1XJ=diff(Xj,t);
D2XJ=diff(D1XJ);
eq1=Mp*diff(Xp,t,2)-Mp*g-k*(Xj-Xp)+Bp*diff(Xp,t)==0;
eq2=Mj*diff(Xj,t,2)-Mj*g+k*(Xj-Xp)+Bj*diff(Xj,t)==0;
f1=laplace(eq1,s);
f1=subs(f1,{laplace(Xp(t),t,s),Xp(0),D1XP(0)},{Xp(s),0,0})
f2=laplace(eq2,s);
f2=subs(f2,{laplace(Xj(t),t,s),Xj(0),D1XJ(0)},{Xj(s),0,0});
ı am traying to change laplace(Xj(t), t, s) in f1 as a some funciton of Xp ı can derive an expression for Xj in terms of Xp from eq2 but how can ı ımplement in f1 ?
0 Comments
Answers (1)
Vinay
on 30 Oct 2024
The laplace(Xj(t), t, s) value from f1 can be expressed in terms of Xp(s) by isolating the value using the 'isolate' command as showf1_sub = subs(f1, XJ(s), rhs(XJ_expr));
disp(f1_sub)n below
XJ_expr1 = isolate(f1, laplace(Xj(t), t, s));
disp(XJ_expr1)
The expression for the Xj(s) in terms of laplace(Xp(t), t, s) can be solved using the 'isolate' in the equation f2 as
XJ_expr = isolate(f2, XJ(s));
disp(XJ_expr)
The value of XJ(s) from f2 is substituted in place of laplace(Xj(t), t, s) in f1 using the 'subs' command as
f1_sub = subs(f1, laplace(Xj(t), t, s), rhs(XJ_expr));
disp(f1_sub)
The code below shows the implementation of changing the variable
% Define constants
Mj = 70; % kg
Mp = 25; % kg
Bj = 13; % N/(m/s)
Bp = 140; % N/(m/s)
k = 400; % N/m
g = 9.81; % m/s^2
% Define symbolic variables
syms Xp(t) Xj(t) t s XP(s) XJ(s)
% Define differential equations
eq1 = Mp*diff(Xp, t, 2) - Mp*g - k*(Xj - Xp) + Bp*diff(Xp, t) == 0;
eq2 = Mj*diff(Xj, t, 2) - Mj*g + k*(Xj - Xp) + Bj*diff(Xj, t) == 0;
% Take Laplace transforms
f1 = laplace(eq1, t, s);
f1 = subs(f1, {laplace(Xp(t), t, s), Xp(0), subs(diff(Xp, t), t, 0)}, {XP(s), 0, 0});
f2 = laplace(eq2, t, s);
f2 = subs(f2, {laplace(Xj(t), t, s), Xj(0), subs(diff(Xj, t), t, 0)}, {XJ(s), 0, 0});
% Isolate XJ(s) in terms of XP(s) from f2
XJ_expr = isolate(f2, XJ(s));
disp(XJ_expr)
% Substitute the isolated XJ(s) from f2 in place of laplace(Xj(t), t, s)
f1_sub = subs(f1, laplace(Xj(t), t, s), rhs(XJ_expr));
disp(f1_sub)
% Simplify the resulting equation
f1_simplified = simplify(f1_sub);
% Display the simplified equation
disp('The simplified equation in terms of XP(s) is:');
disp(f1_simplified);
Kindly refer to the below documentations for more details:
I hope this helps!
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!