How to stop ode integration?
2 ビュー (過去 30 日間)
古いコメントを表示
I'm trying to solve a differential equations system with ode45 solver. But sometimes integration takes too much time because one of three values in the system becomes too small. As I understood I should use an event in ode function.
function [value,isterminal,direction] = events(t,y)
value = y(1) - 0.0000001;
isterminal = 1;
direction = 0;
How to write the event not just only for one y value, but for all three of them?
0 件のコメント
採用された回答
Walter Roberson
2014 年 2 月 6 日
function [value,isterminal,direction] = events(t,y)
miny = [0.0000001, 0.000000025, -83.9]; %for example
value = y < miny;
isterminal = 1;
direction = 0;
2 件のコメント
Walter Roberson
2014 年 2 月 6 日
Ah, it should probably be
isterminal = ones(size(y));
direction = zeros(size(y));
その他の回答 (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!