how do i get the timestep of odesolver
이전 댓글 표시
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
답변 (2개)
Nathan Crosty
2013년 7월 23일
1 개 추천
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
2013년 7월 25일
0 개 추천
댓글 수: 4
Nathan Crosty
2013년 7월 25일
The time that gets returned contains the actual "step time" that you are looking for. For instance, you can tell how long certain points of your simulation took with a variable step solver.
Jan
2013년 7월 25일
@Moritz: What exactly is a time-step in an ODE solver? Should steps rejected by the step-size control be considered or not?
Perhaps your problem would be more clear, if you show us the details of the function to be integrated.
Richard Brown
2013년 7월 26일
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
2013년 8월 5일
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.
카테고리
도움말 센터 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!