ODE discrete variable problem

Hi all, I have a system of ODEs with a (non-negative) variable, V, that can be modelled continuously. All good up to here, but since V is actually a discrete variable, when its value is below 1 we crucially need it to be set to zero. Since the ODE solvers only output the complete solution of V at the end, and you can't manipulate the solution's values as the system is being integrated, I can't find a way to implement this condition. Any ideas? Many thanks,
Mark

Respuestas (1)

Bjorn Gustavsson
Bjorn Gustavsson el 26 de Jul. de 2011

0 votos

Maybe you can get by by using the events field sent to the ode-integrating function. That is what is used for example to calculate the trajectory of bouncing balls in ballode.m. Maybe you can use that to modify your solution and keep integrating or just terminate when V reaches 0 and restart the integration from that time with the modified solution as initial condition.
HTH

Preguntada:

el 26 de Jul. de 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by