What function should I choose while sometimes ode45 will fall into endless loop?
2 ビュー (過去 30 日間)
古いコメントを表示
Actually,the problem to solve sometimes don't have a solution. In this case, the ode45 will fall into endless loop, and could not stop itself. As a build-in function, tic-toc control can not apply to it, so I try to use other ode-functions, they all will automatically stop and throw a warning. That's good for me. But I'm not sure if they can always do this everytime. In all, my question is: is there a function of ode that will never fall into endless loop? If there is or there are, please name it or them, and I would really appreciate if the reason can be explain.
0 件のコメント
採用された回答
Jan
2011 年 7 月 8 日
As far as I know, ODE45 does never fall into an infinite loop. But the stepsize can be very small, such that the calculation take a lot of time. Then limiting the smallest step size is helpful usually.
Another idea is using an Event function, which drops a terminal event after a specified amount of time. A persistent variable in side this Event function might be usful for this job.
5 件のコメント
Jan
2011 年 7 月 11 日
The event function is triggered, if the value changes its sign, but "double(toc<0.00001)" is 1 always. In addition the solver tries to locate the exact time of the event by further evaluations of the ODE. Perhaps it is a more stable idea to modify a copy(!) of the ODE45 function, e.g. with a limit the number of calculated steps.
Concerning the email: *One* email would not be a problem, but I get too many of them comming from this forum. And most of them are less polite than you are. Thanks.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!