ODE solvers - why is Matlab ode45 uncannily stable?

  ## Factor multiplying the stepsize guess
  facmin = 0.8;
  facmax = 1.5;
  fac = 0.38^(1/(order+1));  # formula taken from Hairer

    ## Compute next timestep, formula taken from Hairer
    err += eps;  # avoid divisions by zero
    dt *= min (facmax, max (facmin, fac * (1 / err)^(1 / (order + 1))));

Octave is only using I-control, so I would not think it would not be an algorithm that would match MATLAB stepwise, but if you want to do this one you’d do:

@time solutionDP5Lowdt = solve(problem,DP5(),qmax = 1.5, qmin = 0.8,
                               gamma = 0.38^(1/(order+1)),
                               controller = OrdinaryDiffEq.IController())
plot(solutionDP5Lowdt)
1 Like