Usually any ode like ode23, ode 45 will do the integration from initial time to final time [t0 tf]. Is there a way, the integration can be stopped on some other parameter not dependent on time? For example, I have a linear damper.
Initial Pressure p1 = some value
Initial Pressure p2 = some value (not = p1)
time = [t0 tf]
some other constants
options = odeset
y0 = [initial conditions for some parameters containing p1 and p2]
[t,y] = ode45(@func,[t0 tf],y0,options,other constants to carry)
and in func code:
equations for integration for p1 and p2 and some other variables
How would it be possible to not run the ode from t0 to tf but stop it when p1 = p2? Or some way I can pre decide the limits for p1 and p2 so that the ode does not exceed them? Please help. Thanks