MATLAB Answers

Zixuan Li
0

what's the difference in accuracy between solving a stiff problem by ode15s and ode45?

Zixuan Li
さんによって質問されました 2019 年 3 月 26 日
最新アクティビティ Josh Meyer
さんによって 回答されました 2019 年 3 月 27 日
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 件のコメント

Torsten
2019 年 3 月 26 日
Why do you think so ? Because there are more data on a finer grid ?

サインイン to comment.

タグ

2 件の回答

回答者: John D'Errico
2019 年 3 月 26 日
 採用された回答

Actually, in many cases, sufficiently stiff problems see a solver like ODE45 grind to a complete halt, unable to pass a point where the step size needs to get so small that no effective progress is deemed possible. Yes, ODE45 can push through some problem regions. Not all stiff problems are equally nasty.
As for ODE45 producing a different result, when that happens, it usually means that it got the wrong result, not a more accurate one. So ODE45 may have gotten onto a completely different trajectory. It survived the stiff region, but to what effect, if the answer is wrong?

  0 件のコメント

サインイン to comment.


回答者: Josh Meyer
2019 年 3 月 27 日

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);

  0 件のコメント

サインイン to comment.



Translated by