Piecewise ode15i

1 回表示 (過去 30 日間)
jf
jf 2021 年 2 月 19 日
コメント済み: jf 2021 年 2 月 19 日
Suppose that given DAE system containing peicewise defined function.
What is more convenient way to call ode15i:
a) put conditional statements into function right into separate file (as daeFunction is capable to generate)
b) define solver event option and have bunch of DAE systems for each condition, than call them in adequate way?
I am missing this in documentation. Is there some issue with a) aproach?

採用された回答

Walter Roberson
Walter Roberson 2021 年 2 月 19 日
Unfortunately, you need to use event functions and terminate the ode*() call at that location, and then start it up again from where it left off
It is not exactly the case that you cannot have any condition statements inside the function. However, for any one call to ode15i(), any condition statements you do have must be C2 (continuous second derivative.) I know very little about the math of ode15i() specifically, so I am not certain if it needs even higher continuity.
Sometimes it is easier to switch to integrating a different function handle; sometimes it is easiest to use the same function handle each time, but this time the piecewise happens to fall into a different branch.
A few weeks ago, we had someone who needed to have a force turned on during part of a quasi-periodic cycle. The exact times were a bit inconvenient to calculate in advance. So we used an event function to terminate, but we also used an additional parameter representing whether the force was to be turned on or off this cycle; http://www.mathworks.com/help/matlab/math/parameterizing-functions.html
  1 件のコメント
jf
jf 2021 年 2 月 19 日
Excellent answear, thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by