what the time span do in ode45?

조회 수: 33 (최근 30일)
SAHIL SAHOO
SAHIL SAHOO 2022년 7월 23일
댓글: Bruno Luong 2022년 7월 23일
[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" ?

답변 (1개)

Bruno Luong
Bruno Luong 2022년 7월 23일
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
Jan
Jan 2022년 7월 23일
@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 2022년 7월 23일
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.

댓글을 달려면 로그인하십시오.

카테고리

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