Cap Maximum ODE solve time

조회 수: 8 (최근 30일)
mihir
mihir 2025년 7월 11일
편집: Torsten 2025년 7월 13일
I am solving a set of ODEs with several different initial conditions some of which will be badly conditioned and get bogged down. I want to cap the run time of an individual solve to say 100 seconds. If it reaches 100 seconds, I want to exit and just mark the solve as fail. I haven't been able to find a way to do this on the forum. Does anyone have any suggestions?
  댓글 수: 1
Sam Chak
Sam Chak 2025년 7월 11일
Hi @mihir,
What is the order of your dynamic system? You can determine this by identifying the number of state variables. If, from the map of the state space in the operating range, you can identify which regions are badly conditioned, would you avoid selecting the initial values from those regions?

댓글을 달려면 로그인하십시오.

답변 (2개)

Torsten
Torsten 2025년 7월 11일
편집: Torsten 2025년 7월 11일
Josh Meyer's answer shows you one possible way to do this:
I suggest you also define the stop time in your script and pass it to the event function via the call to the ODE integrator instead of setting it in the event function itself.

John D'Errico
John D'Errico 2025년 7월 12일
Simpler is to just set the maximum number of evals or iterations. This way you don't need to do anything special, just set a flag that already exists. It will do effectively the same thing as what you asked for.
  댓글 수: 1
Torsten
Torsten 2025년 7월 12일
편집: Torsten 2025년 7월 13일
I don't see such an option in "odeset".

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

태그

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by