Is ode45 always calculate the entire function even if she has been asked only for specific values?

5 visualizaciones (últimos 30 días)
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?

Respuesta aceptada

Torsten
Torsten el 14 de Ag. de 2022
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).

Más respuestas (0)

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by