Event function in ODE45

1 view (last 30 days)
Sunit Gupta
Sunit Gupta on 14 May 2014
Answered: Star Strider on 14 May 2014
Hi, I have to create an event function for ode45 that terminate the integration as the quantity say x,becomes grater than 0. I know how to write it for x=0. but for x>0 or x<0, i could not figure out. Please help me out for this.
Regards Sunit

Answers (1)

Star Strider
Star Strider on 14 May 2014
Under ‘Event Location’ the options are:
  • -1 Detect zero crossings in the negative direction only
  • 0 Detect all zero crossings
  • 1 Detect zero crossings in the positive direction only
So it would seem that the +1 option would be what you want.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!