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?

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 19 Feb. 2021

0 Stimmen

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

Weitere Antworten (0)

Kategorien

Mehr zu Numerical Integration and Differential Equations finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

jf
am 19 Feb. 2021

Kommentiert:

jf
am 19 Feb. 2021

Community Treasure Hunt

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

Start Hunting!

Translated by