フィルターのクリア

ode15s - accept solution

1 回表示 (過去 30 日間)
Simon
Simon 2015 年 11 月 30 日
回答済み: Torsten 2015 年 11 月 30 日
Hello,
I solve an ODE system with the ode15s solver.
The system has very big positiv and negative gradients. If a gradient is negative and the timestep is too big, my solution gets negative.
However, this result is not physicaly correct and my next timestep breaks down because I like to calculate with this negative temperature other values. Normaly the solver "sees" that the timestep was to big and adjusts it self. But in this case (the gradient was to negative) a other function returns an error because the negative temperature and the hole calculatin stops.
How can I modify my code that I don't come to this case? I know that my model is OK, just the automatic time step from the ODE solver is to big.
Thanks for help.

採用された回答

Torsten
Torsten 2015 年 11 月 30 日
Use something like
T=y(1);
if T < 0
T = 1e-3;
end
in the routine where you supply your gradients.
Best wishes
Torsten.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by