how can I condition my ode solver

I use an ode solver here
[t, R] = ode78(@odefun, tspan, r0);
but I don't want it to run until the final t, I want it to run until R is at a certain value, and I have no idea how to go about doing that.

답변 (1개)

Torsten
Torsten 2023년 6월 15일
이동: Torsten 2023년 6월 15일

0 개 추천

Use the Event Facility of the ODE integrators:

댓글 수: 2

Noya Linder
Noya Linder 2023년 6월 16일
And what happens if the "position" is not exactly zero? How can I specify tolerance to the value which will result in a termination?
Torsten
Torsten 2023년 6월 16일
편집: Torsten 2023년 6월 16일
ode78 checks where the expression (R - certain value) changes sign. This is the position where R reaches the specified value. There is no need to specify a tolerance.

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

카테고리

질문:

2023년 6월 15일

편집:

2023년 6월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by