How to solve a systems of ODE and Algebraic Equations
28 次查看(过去 30 天)
显示 更早的评论
I have a system of 3 nonlinear ODE and 2 nonlinear algebraic equations.
Please how can I solve these systems of equation.
ODE 45 can easily solve the ODE part. However, I don't know how to combine the solution from ODE45 and the algebraic equations.
Thank you.
2 个评论
jessupj
2021-1-28
编辑:jessupj
2021-1-28
it sounds like what you're after is "how to solve a DAE" if the algebraic eqations constrain the solutions of the ODE part https://www.mathworks.com/help/matlab/math/solve-differential-algebraic-equations-daes.html
otherwise, if the algebraic equations aren't constraints (ie. they determine diagnostic variables), you probably want to solve the ODE and then solve the algebraic equations 'offline' using e.g. fsolve
采纳的回答
jessupj
2021-1-28
编辑:jessupj
2021-1-28
looks like you've got a non-autonomous DAE.
with u=x(4) and y = x(5), you'd have:
dx(1) = -wh.*x(1) + wh.* x(5)
dx(2) = -wl.*x(2) + A.*sin(w.*t).* wl.*(x(5) - x(1))
dx(3) = K.*x(2)
0 = x(3) + A.* sin(w.*t) - x(4)
0 = 25 - (5 - x(4) ).^2 - x(5) % = 25 - (25 -10*x4 + x4^2) -x5 = x4*(10 -x4)-x5
and check this old post:
https://www.mathworks.com/matlabcentral/answers/360710-how-to-solve-a-set-of-odes-and-a-nonlinear-equation
更多回答(1 个)
Telema Harry
2021-1-28
编辑:Telema Harry
2021-1-28
2 个评论
Alex Sha
2021-1-29
Hi, since: u = x(3) + A.* sin(w.*t) and y = 25 - (5 - u).^2, so y = 25 - (5 - ( x(3) + A.* sin(w.*t))).^2, substitute y into dx1dt and dx2dt, then pure ODE functions will be formed.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!