Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: forced discard of ODE step
Replies: 4   Last Post: May 27, 2013 7:40 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Mateusz Gos

Posts: 32
Registered: 12/8/08
Re: forced discard of ODE step
Posted: May 26, 2013 9:20 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Nasser M. Abbasi" wrote in message <knpfc0$v38$1@speranza.aioe.org>...
> On 5/24/2013 10:17 PM, Mateusz Gos wrote:
> > Hi,
> >
> > I have a set of differential equations solved with ode45.
> > At times it might be possible for the solver to find a valid time step
> > (meeting the tolerance criteria), but for some of the variables in that
> >time step to be physically not possible. So in other words such step is
> >correct mathematically, but not physically.
> > Of course I can check for these variables, but how do I make the solver
> > discard a particular iteration and start a new one with different time
> > step, regardless of what it has determined tolerance-wise?
> >
> > Thank you,
> > Matt
> >

>
> I do not know how you can make it discard the step, since it
> allready made it. But may be you can stop ode45 at the point of
> your choice and then restart it again using IC at that point
> such that the new IC's is what you want to use. If so, you can
> look at ode45 OutputFcn
>
>
> http://www.mathworks.com/help/matlab/ref/odeset.html
>
> "The solver calls status = myfun(t,y,[]) after each integration step
> on which output is requested. t contains points where output was generated
> during the step, and y is the numerical solution at the points in t. "
>
> ....
>
> "myfun must return a status output value of 0 or 1. If status = 1,
> the solver halts integration. You can use this mechanism, for
> instance, to implement a Stop button."
>
> I've used OutputFcn for display the solution as ode45 was running
> for another reason, but it is possible to use it to check for specific
> conditions and halt ode45. Then restart again, since you know the
> solution at that moment.
>
> --Nasser


Yes, I already use the output function anyway. I admit it is not the answer I was hoping for, but thanks for the idea.

Matt



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.