Solving coupled ODE symbolically
3 views (last 30 days)
Show older comments
saravanakumar D
on 25 Dec 2021
Commented: saravanakumar D
on 26 Dec 2021
I need to solve this coupled ODE through laplace transform.
My algorithm
- I have written the 2nd order ODE in matrix form.
- Took laplace transform
- Substituted the initial conditions. (Help Needed: Could not substitute diff(x1(0)) and diff(x2(0)) as zero.
- Solve the linear equation (Help Needed: Don't know what to do)
I have attached my code.
syms t s x1(t) x2(t) m1 m2 c1 c2 k1 k2 k_c c_c Delta_m f1 f2 omega f_0
M=[m1 0;0 m2]
C=[c1+c_c -c_c;-c_c c2+c_c]
K=[k1+k_c -k_c;-k_c k2+k_c]
F=[f1;f2]
X=[x1;x2]
equ=M*diff(X,t,2)+C*diff(X,t)+K*X==F
equ=subs(equ,[f1,f2],[f_0*cos(omega*t),0])
L1=laplace(equ)
L2=subs(L1,[x1(0),x2(0),diff(x1(0),t,1),diff(x2(0),t,1)],[0 0 0 0]) %Substituting Zero Initial Condition
% In above step the time derivative has to be zero, but it is not.
Sol=solve(L2,[laplace(x1) laplace(x2)])
0 Comments
Accepted Answer
Walter Roberson
on 25 Dec 2021
syms t s x1(t) x2(t) m1 m2 c1 c2 k1 k2 k_c c_c Delta_m f1 f2 omega f_0
M=[m1 0;0 m2]
C=[c1+c_c -c_c;-c_c c2+c_c]
K=[k1+k_c -k_c;-k_c k2+k_c]
F=[f1;f2]
X=[x1;x2]
equ=M*diff(X,t,2)+C*diff(X,t)+K*X==F
equ=subs(equ,[f1,f2],[f_0*cos(omega*t),0])
L1=laplace(equ)
dx1 = diff(x1)
dx2 = diff(x2)
lap1 = laplace(x1)
lap2 = laplace(x2)
syms LAP1 LAP2
L2 = subs(L1, {x1(0), x2(0), dx1(0), dx2(0), lap1, lap2}, {0, 0, 0, 0, LAP1, LAP2}) %Substituting Zero Initial Condition
Sol = solve(L2, [LAP1, LAP2])
LAP1s = simplify(Sol.LAP1)
LAP2s = simplify(Sol.LAP2)
%iLap1 = ilaplace(LAP1s)
%iLap2 = ilaplace(LAP2s)
The ilaplace() take longer than this demonstration facility allows
More Answers (0)
See Also
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!