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: Re: ODEs taking variables below 0
Replies: 2   Last Post: Mar 28, 2013 4:10 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Richard Crozier

Posts: 111
Registered: 3/19/09
Re: ODEs taking variables below 0
Posted: Mar 28, 2013 4:10 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Matthew" wrote in message <kj1sea$ab6$1@newscl01ah.mathworks.com>...
> I have my event stopping at the right place but it wont just cap the variable and continue.
>
> Heres what I have:
>
> function [value,isterminal,direction] = events(t, z,design)
> value = [xend - z(3); (xend + z(3)];
> isterminal = [0; 1];
> direction = [0; 0];
> end
>
> I don't understand what direction does? Terminal simply stops the integration if its a 1 and lets its keep on running if its a 0. I want it to stop integrating if its going past that.



The direction lets you specify whether the function was increasing when it crossed the threshold or decreasing, or if it doesn't matter.

if direction is zero it will always raise an event when crossing the threshold

if direction is +1 it will only create an event if the threshold is crossed from below (i.e. the function is increasing)

if direction is -1 it will only create an event if the threshold is crossed from above (i.e. the function is decreasing)



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.