Setting solution bounds in ode45

12 visualizzazioni (ultimi 30 giorni)
Vitaly Kheyfets
Vitaly Kheyfets il 31 Mar 2023
Risposto: Vitaly Kheyfets il 31 Mar 2023
Hello -
I have a system of 8 coupled ODEs. For one of the variables, I know that the solution should stay within a minimum and maximum value in order to be physiological. Is there a way for me to force the solution to stay without some bounds?
Thanks You,
Vitaly
  1 Commento
Steven Lord
Steven Lord il 31 Mar 2023
How do you want to handle the situation where the solution is set to exceed the bounds you've set? I can think of several possible approaches:
  • If you're using this to try to identify parameters for the system, reject the set of parameters you're currently simulating. If your predator birth rate in a predator-prey system model results in a point where there are -1 predators around, that's not physically realizable.
  • Apply some sort of correction to the system. One way to do this is with an Events function. See for example the ballode example, which uses an event function to detect when the ball has struck the ground. It then modifies the state of the system to reflect the ball bouncing and starts solving from that point with the modified system.
  • Modify your system from the start. Perhaps some factor that you thought you could safely neglect isn't quite as negligible as you thought. For example, in a simple ballistics problem in an introductory physics class you can often ignore the wind. That's not necessarily the case if you're trying to fire a projectile into the eye of a hurricane to study it.
What approach do you want to use?

Accedi per commentare.

Risposte (1)

Vitaly Kheyfets
Vitaly Kheyfets il 31 Mar 2023
Thank You to everyone for the thoughtfull advice! After experimenting with this today, I chose the route of applying a correction to the system of ODEs. While I can't honestly brag about it working yet, it helped me reach a new level of understanding for the system I was solving and I think I have some ideas to make things function.
Thanks again!
Vitaly

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by