> Hi all, > > i'm using the ode45 function in matlab in a certain > time interval (i.e 80-200 seconds). i want the ode45 > to integrate my ODE until it reaches certain value > and then stop but! then i want it to go back to a > certain baseline value (in the y axis) and continue > the integration (until again, stops and go back to > baseline if it reaches that same specific value as > before) throught the entire time interval. > > Any help will be appreciated :)
When ode45 reaches the value in question, set isterminal=1 in the event function. Then ode45 stops integration. In the calling program, reset the y-value and call ode45 again. This can be done repeatedly in a while-loop until ode45 reaches the end of the time interval.