From: Torsten Hennig on
> Hello,
>
> I've developed a model using the ODE45 solver. It
> worked fine, but now the solver has difficulties with
> a switching variable. I used this variable from the
> beginning and had no difficulties with it before.
> Here is a simplified summary of what happens:
>
> if Y1 < Y2 then R = x, else R = y
> dV1dt = Y3*C + Y2/R - Y1/((R+C)/2)
>
> Thus the only switching variable is R, and this seems
> to make the model unstable. However, this R is very
> crucial for the model. How can I solve this
> instability?

What do you mean by 'this seems to make the model
unstable' ?
Maybe defining an event function can help - look at
the ballode problem under
http://www.mathworks.com/access/helpdesk/help/techdoc/math/f1-662913.html#f1-669698

Best wishes
Torsten.