"Torsten" wrote in message <firstname.lastname@example.org>... > "Mateusz Gos" <email@example.com> wrote in message <firstname.lastname@example.org>... > > Hi, > > > > I have a set of differential equations solved with ode45. At times it might be possible for the solver to find a valid time step (meeting the tolerance criteria), but for some of the variables in that time step to be physically not possible. So in other words such step is correct mathematically, but not physically. > > Of course I can check for these variables, but how do I make the solver discard a particular iteration and start a new one with different time step, regardless of what it has determined tolerance-wise? > > > > Thank you, > > Matt > > You did not explain in more detail what you mean by "not physically correct", but the NonNegative option of the ODE solvers might be of help. > > Best wishes > Torsten.