How to fix the time step in ODE45
Mostra commenti meno recenti
I want to fix the time step for my ode45 function. The code which I am using is as follows:
dt = 0.02;
tf = 600;
t = dt:dt:tf;
y0 = zeros(14,1);
[tout,yout] = ode45(@OC3_odefull,t,y0);
When I run my code, I have no control over the time step size and ode45 uses an adaptive time step. Is there any way that I can force ode45 to use the time step that I want?
2 Commenti
Jan
il 8 Lug 2018
The "45" means, that each step is calculated with an order 4 and order 5 method. The difference between the results is used to control the step size. It is not meaningful to run an ODE45 method with a fixed step size.
Abla Nevame Edzenunye
il 12 Ott 2022
Thank you!!!
Risposta accettata
Più risposte (1)
Walter Roberson
il 7 Lug 2018
2 voti
No, you cannot do that.
Officially, Mathworks only provides variable step solvers for MATLAB use.
Unofficially, see https://www.mathworks.com/matlabcentral/answers/98293-is-there-a-fixed-step-ordinary-differential-equation-ode-solver-in-matlab-8-0-r2012b#answer_107643 for the fixed step routines ode1 through ode5 .
Categorie
Scopri di più su Ordinary Differential Equations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
