Mercurial > octave
changeset 22658:56d7d423aff9 stable
Return intermediate integration times when single output argument used in ode solver (bug #49417).
* ode23.m, ode45.m: If single output is requested then shorten integration
span to a 2-element vector which will cause integrate_adaptive to return
auto-selected timesteps.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 23 Oct 2016 21:33:38 -0700 |
parents | 6b134d294d61 |
children | 04fc7e9c5f96 |
files | scripts/ode/ode23.m scripts/ode/ode45.m |
diffstat | 2 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ode/ode23.m Sat Oct 22 22:11:42 2016 +0200 +++ b/scripts/ode/ode23.m Sun Oct 23 21:33:38 2016 -0700 @@ -224,6 +224,12 @@ endif endif + ## Single output requires auto-selected intermediate times, + ## which is obtained by NOT specifying specific solution times. + if (nargout == 1 && numel (trange > 2)) + trange = [trange(1) trange(end)]; + endif + solution = integrate_adaptive (@runge_kutta_23, order, fun, trange, init, odeopts);
--- a/scripts/ode/ode45.m Sat Oct 22 22:11:42 2016 +0200 +++ b/scripts/ode/ode45.m Sun Oct 23 21:33:38 2016 -0700 @@ -215,6 +215,12 @@ endif endif + ## Single output requires auto-selected intermediate times, + ## which is obtained by NOT specifying specific solution times. + if (nargout == 1 && numel (trange > 2)) + trange = [trange(1) trange(end)]; + endif + solution = integrate_adaptive (@runge_kutta_45_dorpri, order, fun, trange, init, odeopts);