what's the difference in accuracy between solving a stiff problem by ode15s and ode45?
Show older comments
It seems ode45 can also solve a stiff problem, but takes more time ( there are more data on finer grid as well, but the curve is still differennt from that of ode15s). Does this mean ode45 can do better in terms of accuracy?
1 Comment
Torsten
on 26 Mar 2019
Why do you think so ? Because there are more data on a finer grid ?
Accepted Answer
More Answers (1)
Josh Meyer
on 27 Mar 2019
Stiffness is more of an issue of stability than accuracy. Nonstiff solvers can solve stiff problems, it just takes them a long time to do so.
I would also note that since ode45 is meant to be a general-purpose solver, it uses interpolation to output extra points per step, which leads to better plots. This is controlled by the 'Refine' option, which has a value of 4 for ode45 and 1 for all other solvers. So if you want ode15s to output some extra points per step as well, just use
opts = odeset('Refine',4);
[t,y] = ode15s(@odefcn,tspan,y0,opts);
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!