MATLAB Answers

Gerard
0

Is it possible to terminate ode45 once a certain condition is met during integration?

Asked by Gerard
on 20 Mar 2013
Hi, I'm working on a problem where I'm integrating a state position vector [x y z]'. and I want the output of the first line where my x value is below a certain tolerance. Is there a way to incorporate a line in my equations of motion that will tell the ode45 function to stop and give me the last calculated values?

  0 Comments

Sign in to comment.

1 Answer

Answer by Babak
on 20 Mar 2013

to stop the integration you need to define an "event" function. Loop up ODE45 documentation and see how you can define the event function as an option to the ODE45 integrator.

  0 Comments

Sign in to comment.