ODE45, ODE113 How to get the step size in advance?

조회 수: 4 (최근 30일)
Antillar
Antillar 2011년 8월 18일
댓글: Jan 2017년 10월 9일
Hi guys,
Is there any way to get the step size in advance from ODE45, ODE113?

답변 (3개)

Jan
Jan 2011년 8월 18일
No. These solver use adpative methods to determine the stepsize dynamically. Therefore you cannot get it without running the intergration.
Why do you need this?
  댓글 수: 2
Antillar
Antillar 2011년 8월 18일
This is my dilemma:
I set my integration interval to say z=[0 5]. My initial conditions vary in discrete steps as a function of this length, i.e z0=[sech(z) tanh(z)].
Jan
Jan 2011년 8월 18일
I do not get the problem. You can define the interval and the initial conditions, because both do *not* depend on the stepsize.

댓글을 달려면 로그인하십시오.


Friedrich
Friedrich 2011년 8월 18일
Hi,
ODE45 and ODE113 have variable step size and this size is choosen during solving. So there is no stepsize you can get.
  댓글 수: 2
Antillar
Antillar 2011년 8월 18일
Thank you. Is there some way I can "tap" into the decision made by ODE?
Jan
Jan 2011년 8월 18일
Of course you can modify the stepsize control in a copy (!) of ode45.m. But this is really unsual and I cannot imagine a good reason to do this. Therefore I still assume, that you need something else.

댓글을 달려면 로그인하십시오.


Floris
Floris 2011년 9월 6일
You can, if you so wish, set a maximum step size using odeset.
But this not really what you want, is it?
  댓글 수: 4
Torsten
Torsten 2017년 10월 6일
Try a stiff solver, e.g. ODE15S.
Best wishes
Torsten.
Jan
Jan 2017년 10월 9일
@Nader: The step size is not reduced arbitrarily in the solver, but such, that the error bounds are not exceeded. If you set a minimal step size and the integrator cannot satisfy the local discretization error, it stops with an error message - and it should do so. Fording the integrator to use too large steps leads to inaccurate results. Therefore I disagree, that this "solves" the problem. In opposite: If this works with another tool, it hides the fact, that the problem is not solved, but that you obtain a rough and perhaps completely wrong result.
Maybe your ODE is stiff. Then follow Torsten's suggestion.
ODE integrators and local optimization tools are fragile. You can get a "final value" even if you drive the tools apart from their specifications. Calling this a "result" without an analysis of the sensitivity (measure how the trajectory reacts to small variations of the inputs or parameters) is not scientifically correct. You can find many publications with such mistakes.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by