How to write ode45 to solve differential equations with changing parameters
2 次查看(过去 30 天)
显示 更早的评论
I am going to solve the differential equations:
dX = f(X, U, P), X is system states, U is control inputs which is known, and P is function of X, U and P itself. Since nonlinearity, P cannot be expressed analytically.
I tried to use ode45, but I have to use a for-end loop to upgrade my P for every step. Is there anyway I can avoid using for-end loop here? For example, just use ode45 to integrate my equations for one go?
I'm new to MATLAB, I will be very thankful if you let me know how to write it in detail. Thank you very much.
2 个评论
Torsten
2015-4-7
dX=f(X,U,P) P-f2(X,U,P)=0
This is a differential-algebraic system which can be solved by ODE15S, e.g.
Best wishes
Torsten.
回答(1 个)
Jan
2015-4-6
Please explain the values of U and P with details. Is the function to be integrated still smooth? Otherwise ODE45 cannot handle it reliably. See http://www.mathworks.com/matlabcentral/answers/59582#answer_72047
另请参阅
类别
在 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!