what the time span do in ode45?

29 visualizaciones (últimos 30 días)
SAHIL SAHOO
SAHIL SAHOO el 23 de Jul. de 2022
Comentada: Bruno Luong el 23 de Jul. de 2022
[time,Y] = ode45(f,tspan./tp,[sqrt(0.05);sqrt(0.05);0;0;0.1]);
in this, is it means that we differentiaite the y by "t/tp" ?

Respuestas (1)

Bruno Luong
Bruno Luong el 23 de Jul. de 2022
No, it means exactly what in the doc says
"tspan — Interval of integration
vector
Interval of integration, specified as a vector. At a minimum, tspan must be a two-element vector [t0 tf] specifying the initial and final times.
To obtain solutions at specific times between t0 and tf, use a longer vector of the form [t0,t1,t2,...,tf]. The elements in tspan must be all increasing or all decreasing."
  9 comentarios
Jan
Jan el 23 de Jul. de 2022
@Bruno Luong: Walter is right. The output at the tspan points is interpolated. This is cheaper than interpolating afterwards, because it uses the information obtained be the function evaluations of the integrator. In addition this let the step size control determine the steps instead of increasing the number of function evaluations, which would increase the accumulated discretization and rounding errors also.
See the private help function ntrp45split.m and the reference: Mark W. Reichelt and Lawrence F. Shampine, 6-13-94 page 15:
Exploiting the freedom provided by a seven stage FSAL formula, Dormand and Prince [13] obtained a number of inexpensive interpolants. They have communicated to us another interpolant of order 4 that is of high quality and free. By free is meant that after a step is accepted, it is possible to construct an interpolant valid throughout the span of the step with no additional evaluations of F. Because solution components can change substantially in the course of a single step, the values computed at the end of each natural step may not provide adequate resolution for graphical display of the solution.
This means, that interpolating afterwards will be less accurate.
Bruno Luong
Bruno Luong el 23 de Jul. de 2022
But all that arguments are only relevant for smooth and non piecewise rhs, for two reasons : (1) the hight order runge_kutta scheme is no longer accurate across the break points and (2) as the solution is not smooth any high order interpolation scheme is actually useless. (Well one reason you can argue).
If I want accurate solution I have to make my own stop and start on each interval.
That's fine but I like to be able to have a compact syntax, in the spirit of MATLAB.

Iniciar sesión para comentar.

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