MATLAB: Does ODE solver (ode15s) produce more solutions than what is set by timespan

inconsistent timespanodeode optionsode solverode15stimespan

I am trying to integrate an ODE system of 5 using ode15s, but I am not sure how to interpret the output solution vector, since the length of timespan and the solution vector is different.
Heres the setup:
options= odeset('RelTol',1e-13,'AbsTol',1e-13,'Refine',1,'MaxStep',1);
tspan = 0:1:3600;
sol = ode15s(@odefun, tspan, [14*10^-9 0 0 0 0], options);
This generates a solution vector of length 1609, but
  • The length decreases if AbsTol is 1e-3 or higher.
  • The length increases if MaxStep is lower.
I had the impression that the ODE solver would seek to produce a solution vector with the same length as timespan (=3600), but I am seeing dramatic variations when manipulating ODE solver options. If I see a solution vector with an increased length, does that mean more timepoints ">length(timespan)" have been used, or does it mean that the solution resolution of the time series has been increased, so instead of having one solution for each time point, it now produces one or more?
I have peaked into the troubleshoot section of ode problems (https://mathworks.com/help/matlab/math/troubleshoot-common-ode-problems.html), but haven't been able to find a clear explanation of how the solution vector should be interpreted.
Thank you in advance,
Ditlev

Best Answer

For some reason, the odeXX functions ignore the tspan vector when called with one output argument. Call them like this
[t,x] = ode15s(@odefun, tspan, [14*10^-9 0 0 0 0], options);
t and x will have same dimensions as tspan.