| Ludek Berec 2007-06-20, 4:25 am |
| Hello. I have the following problem. I solve a system of ODEs via the
ode45.m, like [t,y]=ode45(...) (but I think my question is applicable
to other solvers, too). My equations are such that y-variables are
always non-negative but can come anyhow close to zero. What I need is
to set a variable y exactly to zero once it falls below a
pre-determined value (say 1e-6) yet keep solving until some time tmax
is reached. And I need to do this every time this happens (dimension
of y can be 30 or even more).
I thought I could do it via setting a proper function for the
'OutputFcn' option in 'odeset', but it appears that making some
y-variables equal to zero in that external function does not feed
back to the solver - these variables are again non-zero in the next
integration step which, however, is impossible if it works well, due
to the form of the solved equations. I will appreciate any help. Many
many thanks in advance.
|