How to write ode45 to solve differential equations with changing parameters
3 views (last 30 days)
Show older comments
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 Comments
Torsten
on 7 Apr 2015
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.
Answers (1)
Jan
on 6 Apr 2015
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
See Also
Categories
Find more on Ordinary Differential Equations 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!