ODE discrete variable problem
Show older comments
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
Answers (1)
Bjorn Gustavsson
on 26 Jul 2011
0 votes
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
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!