Is ode45 always calculate the entire function even if she has been asked only for specific values?
1 回表示 (過去 30 日間)
古いコメントを表示
t0=0;
tf=5;
r=5;
s=1;
AnonFun=@(t,x)(r*x-s*x^2);
[t,x]=ode45(AnonFun,[t0,tf],1);
plot(t,x)
For example , if i write [t,x]=ode45(AnonFun,0:3,1);
does ode45 calculate the entire function ? or only this 3 points ?
I mean, will it do the full calculation in the background and return only 3 points?
0 件のコメント
採用された回答
Torsten
2022 年 8 月 14 日
I mean, will it do the full calculation in the background and return only 3 points?
Yes, it will do the full calculation in the background. The array "tspan" is only set for output purposes - it doesn't influence the computations.
By the way: You specified four output points, not three (0,1,2,3).
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!