フィルターのクリア

Initial Step ODE45 not working

1 回表示 (過去 30 日間)
Francesco Fortunato
Francesco Fortunato 2018 年 10 月 20 日
コメント済み: Walter Roberson 2018 年 10 月 21 日
I am using an ode45 with options but my time vector still doesn't have the 1st step as I defined. I should have t=[0 5 15 25 35...] But I have t=[0 10 20 30...]
tspan=[1 10000]
options = odeset('NormControl','on','RelTol',simul.RelTol,'AbsTol',simul.AbsTol,'InitialStep',5,'Refine',1,'stats','off','MaxStep',MaxStp,'OutputFcn',@IntegrationFcn);
[ t , y ] = ode45( @dy , tspan , y_0 , options );
  2 件のコメント
madhan ravi
madhan ravi 2018 年 10 月 21 日
編集済み: madhan ravi 2018 年 10 月 21 日
Upload your code for dy
Francesco Fortunato
Francesco Fortunato 2018 年 10 月 21 日
Sorry, I am not sure I understand what you mean

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

採用された回答

Walter Roberson
Walter Roberson 2018 年 10 月 21 日
When you pass in a tspan that has two elements then ode45 will automatically pick times to evaluate at as needed to maintain accuracy.
You can pass a vector of times instead. ode45 will output for those times. It will continue to evaluate at whichever points it wants to maintain accuracy, but it will calculate for the times given and report only for those.
  2 件のコメント
Francesco Fortunato
Francesco Fortunato 2018 年 10 月 21 日
Thank you for your reply, Could I try to get this a bit straighter? If my tspan is a vector tspan=[5 10 20 30 …] ODE45 will select the point to maintain the accuracy but will output the solution at the instants in tspan; If my tspan has two elements ODE45 will select the points and output the solution at those points. Is it correct?
Walter Roberson
Walter Roberson 2018 年 10 月 21 日
Right. But you would want tspan starting from zero in most conditions, as the first element of tspan tells it the time at which the boundary conditions apply. So for example,
tspan = [0 5 10:10:10000];

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

その他の回答 (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