For Programmers: Free Programming Magazines  


Home > Archive > Matlab > June 2007 > Solving ODEs









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Solving ODEs
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.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com