Using Past Solved Values in with ODE Solvers

1 view (last 30 days)
Noam
Noam on 25 May 2012
Hi all. I'm modelling a fluids problem that involves compressibility, and I'm running into some trouble using found values.
My ODE is solving for the height of water in a tank. I have an equation for density that uses the height found in a previous time step, say t(n-1) to calculate another value used in the current one, t(n). i.e.: density at time t(n) is a function of height at t(n-1).
How can I access the previously found value for height in use for calculations? Or, does the ODE solving algorithm work as what I have described above?
For example I give my ODE an initial condition, ho. When performing the iteration it takes this value to find density, and then calculate a new h value. Then this value would be fed into my equations in the next time step if I had something with an "h" in it, such as density=2*gravity*h.
I've tried to be as clear as I can but please let me know if I can be more so.
Thank you!

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!