How can I solve a series of differential equations in Matlab only until the solution reaches a certain value, then stop?

155 Views Asked by At

I'm solving a series of ODEs in Matlab using ode23 that all 'blow up' for different values. Instead of stating a range to solve over, I want to tell Matlab to solve the equation until the solution becomes greater than a certain amount (1000, say) and then stop, so that I don't have to manually find the solvable range for each equation. Is there a way to do this? I want to do this so I can state a range of values that is the same for each ODE, but each equation is only solved on a subset of that range.