How to give ode45 just 1 time step?

조회 수: 21 (최근 30일)
Saiprasad Gore
Saiprasad Gore 2017년 5월 5일
댓글: Steven Lord 2021년 4월 20일
If I give only one step by tspan = 0:0.01:0.01; then it takes many smaller steps automatically between 0 and 0.01 How can I force it to take just one step?

채택된 답변

Jan
Jan 2017년 5월 5일
ODE45 is an integrator with a step size control, which adjust the steps to satisfy the demands for accuracy. This helps to find the optimum between rounding and discretization errors. In consequence you can and should not force the integrator to use a specific step size.
Use a fixed step size integrator if you have any good reason to do so, but not ODE45.

추가 답변 (1개)

Riyadh BELBECIR
Riyadh BELBECIR 2021년 4월 20일
The smallest value can be taken is two steps
Example :
tspan = [0 1 2];
  댓글 수: 1
Steven Lord
Steven Lord 2021년 4월 20일
The values you specify as the tspan input to an ODE solver do not affect the steps the solver takes internally. If you specify more than 2 elements in tspan they specify the points at which the ODE solver returns the solution.

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

카테고리

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