Integration time step in ODE45 Matlab
7 views (last 30 days)
Hello, I hope you can help me with this problem: I have to find out which is the time step used by the Matlab ode45 during integration. I have to set a value for the variable InitialStep through odeset, but I want to take a number which is similar to the time step used by the solver (I know it has a variable time step size, but I just need to discover the order of magnitude). I don't have to change or work on the output time interval, I am interested in knowing the integration time step size.
Jan on 13 Jul 2023
The output time interval is the integration interval, so you can grab it e.g. in the outputfcn.
Torsten on 13 Jul 2023
Edited: Torsten on 13 Jul 2023
If you use a two-element vector for tspan only giving the start and end time of integration, the values T(i+1)-T(i) (i=1,...,end-1) (computed from the array T returned by the solver) give the basic integration stepsizes taken. Of course, there will be function evaluations also in between the T-values due to the Runge-Kutta formulas.