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!