how can I condition my ode solver

1 次查看(过去 30 天)
Noya Linder
Noya Linder 2023-6-15
编辑: Torsten 2023-6-16
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
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by