Borrar filtros
Borrar filtros

how can I condition my ode solver

1 visualización (últimos 30 días)
Noya Linder
Noya Linder el 15 de Jun. de 2023
Editada: Torsten el 16 de Jun. de 2023
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.

Respuestas (1)

Torsten
Torsten el 15 de Jun. de 2023
Movida: Torsten el 15 de Jun. de 2023
Use the Event Facility of the ODE integrators:
  2 comentarios
Noya Linder
Noya Linder el 16 de Jun. de 2023
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 el 16 de Jun. de 2023
Editada: Torsten el 16 de Jun. de 2023
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.

Iniciar sesión para comentar.

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by