フィルターのクリア

is it possible to change step size of "ode45" ?

23 ビュー (過去 30 日間)
ADNAN KIRAL
ADNAN KIRAL 2018 年 11 月 22 日
コメント済み: Steven Lord 2024 年 5 月 26 日
hi
I was wondering can I change step size of "ode45"? If I am not wrong, the default step size taken by Matlab is 1. I want to make 1/2. how can I change without changing many things in Matlab code. If I assign an "option", is that enough? any other options?
thanks
  1 件のコメント
Jan
Jan 2018 年 11 月 22 日
No, the default step size of ODE45 is not 1. There is not even a default step size. See Torsten's answer: The step size is controlled such, that the provided tolerances are kept.
With using a vector as tspan, you can define the steps in the output, but this is not the internally used step size.

サインインしてコメントする。

採用された回答

Torsten
Torsten 2018 年 11 月 22 日
編集済み: Torsten 2018 年 11 月 22 日
The stepsize of ode45 is not constant, but chosen such that the error tolerances you prescribe are met. Thus mean step size can only be controlled indirectly by strengthening (-> smaller stepsize) or weakening (-> larger stepsize) the error tolerances RelTol and AbsTol.
Or do you mean changing the time instants when MATLAB supplies the solution ?
  3 件のコメント
Torsten
Torsten 2024 年 5 月 24 日
編集済み: Torsten 2024 年 5 月 25 日
You should define the output times you want before calling ode45 in the array "tspan" and call the solver with this array of values. Then the solution will be supplied at these requested output times.
Steven Lord
Steven Lord 2024 年 5 月 26 日
From the description of the tspan input argument on the ode45 documentation page: "If tspan has more than two elements [t0,t1,t2,...,tf], then the solver returns the solution evaluated at the given points. However, the solver does not step precisely to each point specified in tspan. Instead, the solver uses its own internal steps to compute the solution, and then evaluates the solution at the requested points in tspan. The solutions produced at the specified points are of the same order of accuracy as the solutions computed at each internal step." [Emphasis added.]

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by