# Setting solution bounds in ode45

15 ビュー (過去 30 日間)
Vitaly Kheyfets 2023 年 3 月 31 日

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 件のコメント-1 件の古いコメントを表示-1 件の古いコメントを非表示
Steven Lord 2023 年 3 月 31 日
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?

サインインしてコメントする。

### 回答 (1 件)

Vitaly Kheyfets 2023 年 3 月 31 日
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

サインインしてコメントする。

### カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

R2021b

### Community Treasure Hunt

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

Start Hunting!

Translated by