odesolvers: preventing negative values
- From: brisguy04@xxxxxxxxxxxx
- Date: 2 Sep 2005 17:02:53 -0700
Hi,
I am solving systems of ODE using the matalb ode solvers (ode45 and
ode15s). THese odes represent physical quantitiies that must be
positive (e.g. concentrations or population densities), however, at
various times the some of the solution variables get very small and
numberical error means that sometimes the odesolvers give negative
values. For example, in solving some infectious disease models the
number oif infectives can become very small for a significant period
before the number of susceptibles grows to a sufficient number that the
epidemic rtakes off again. If the numerical method gives small, but
negative numbers, then
What is the best way to deal with this?
1. In my fubction for the RHS of the system, just set y to zero or y to
abs(y) before evaluating the RHS? This is what I currently do, and it
seems to work ok, but I am wondering if it is the best approach?
2. I have seen some mention of using the Event Handling to stop the
solution. But this may well happen lots of times i.e. at every time
step within certain time intervals.
3. Are there some numerical methods that preserve the 'positivity' of
the solution values?
Thanks, Glenn.
.
- Follow-Ups:
- Re: odesolvers: preventing negative values
- From: Steven Lord
- Re: odesolvers: preventing negative values
- Prev by Date: Re: XLSREAD - Quick/Easy Question
- Next by Date: odesolvers: preventing negative values
- Previous by thread: Re: XLSREAD - Quick/Easy Question
- Next by thread: Re: odesolvers: preventing negative values
- Index(es):
Relevant Pages
|