The Matlab documentation under de.mathworks.com/help/matlab/ref/ode45.html states:

The time step chosen by the solver at each step is based on the equation in the system that needs to take the smallest step.

This means the solver can take small steps to satisfy the equation for one initial condition, but the other equations, if solved on their own, would use different step sizes.

tspan — Interval of integration (vector)

Interval of integration, specified as a vector. At a minimum, tspan must be a two-element vector [t0 tf] specifying the initial and final times. To obtain solutions at specific times between t0 and tf, use a longer vector of the form [t0,t1,t2,...,tf]. The elements in tspan must be all increasing or all decreasing.

-If tspan has two elements [t0 tf], then the solver returns the solution evaluated at each internal integration step within the interval.

-If tspan has more than two elements [t0,t1,t2,...,tf], then the solver returns the solution evaluated at the given points.

How Matlab determines the step size is only vaguely explained under "tspan — Interval of integration", that's where the know-how is.

You need enough points to get an acceptable plot result at the end. Matlab points out that by choice limits and the steps may change the outcome. You tend to need more steps.

15,905,563 members