Piecewise ode15i

1 visualizzazione (ultimi 30 giorni)
jf
jf il 19 Feb 2021
Commentato: jf il 19 Feb 2021
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?

Risposta accettata

Walter Roberson
Walter Roberson il 19 Feb 2021
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 Commento
jf
jf il 19 Feb 2021
Excellent answear, thank you!

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Programming in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by