how do i get the timestep of odesolver

3 visualizaciones (últimos 30 días)
Moritz
Moritz el 23 de Jul. de 2013
Hello,
i do need the timestep in my equation. Is there a build in way to do that or do i have to monitor it somehow by storing it in a variable between iteration ?
Kind regards
Moritz

Respuestas (2)

Nathan Crosty
Nathan Crosty el 23 de Jul. de 2013
The ODE solvers actually return time... You don't need to do anything extra.
[T,Y] = solver(odefun,tspan,y0)
Where T is the time, and solver is your choice of an ODE function.

Moritz
Moritz el 25 de Jul. de 2013
Yeah, that is obvious but i do need the timestep in my ode. With a fixed time step it would be easy but with a variable timestep solver i am not sure how to do that.
  4 comentarios
Richard Brown
Richard Brown el 26 de Jul. de 2013
I suggest reformulating your problem so you don't need the time step. You can use the actual time t, but the step length is the business of the ODE solver, not your equation ...
Moritz
Moritz el 5 de Ag. de 2013
Richard, you are probably right. I am currently working on it.
If you are interested:
The Formulas: www.ing-mat.udec.cl/~rburger/papers/bck.pdf
It was formula (66) which confused me, but i think i can replace it with equation (56).
The numerical scheme is described on page 4545. I think the formulas are written for an implementation in e.g C++. Using loops is far to slow in matlab.
I solved the same model for centrifugation with the method of lines and ode45. But it was much easier for that case.
So i am rewriting the equations in differential form. Probably it would be possible to code a matrix. But i never did that and i am faster with the MOL.

Iniciar sesión para comentar.

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by