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?

채택된 답변

Torsten
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개)

카테고리

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