Piecewise ode15i
1 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
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
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!