Solving coupled ODE symbolically
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Walter Roberson
2021-12-25
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!