# Which ODE solver in Matlab allows me to advance in just one timestep only

[t,y] = odeXX(odefun,tspan,y0)

I have a solver odeXX, and the tspan = [0 0.0001]. It seems that for any ode solver in MATLAB, they integrate by breaking tspan into multiple steps (some adaptive like ode45 and some non-adaptive). But I am looking for the most primitive one--just integrate from 0 to 0.0001 in one step. Which ode solvers allow me to do this and how to specify this?

• Possible duplicate: stackoverflow.com/questions/2549238/… – yohbs Nov 7 '16 at 2:49
• What's the difference? You're just making a constant step instead of steps. Run ode45 with a constant step that's equal to your end time and you're done. – yohbs Nov 7 '16 at 4:55
• From messing around (MATLAB R2014b) it looks like you can get one step on e.g. ODE45 by setting RelTol,AbsTol,InitialStep and MaxStep large enough. This results in 7 function evaluations – Steve Nov 7 '16 at 11:24
• Why do you want to do this?. – David Ketcheson Nov 7 '16 at 16:04
• But why do you want to check it after one step, rather than checking it after a fixed time interval? I believe that if you explain what you really want to do, then there will be a more useful way to accomplish it. – David Ketcheson Nov 9 '16 at 5:51

Are you asking for a method that solves $x'(t)=f(t,x(t))$, $x(0)=x_{0}$ with only one evaluation of $f$ or are you willing to evaluate $f$ at multiple points? How accurate a solution do you need?
Although MATLAB's built-in solvers with adaptive step sizes won't do this for you, it's trivial to implement your own method. e.g. Euler's method is simply $x_{1}=x_{0}+hf(t_{0},x_{0})$. Implementing RK4 isn't much harder.
• @Brian Borchers not only that. I want to do multiple things to the output at each "step" and update the ODE.y (as in scipy) and carry on the ODE.integrate(..., step=1) again. So I cannot afford to do this in ode45, which takes multiple steps so it is time-consuming. – diff Nov 8 '16 at 6:37