Mercurial > octave
changeset 22673:7c45d565d1b7
odeplot.m: Accept multiple input times (bug #49449).
* odeplot.m: Remove no longer used idx variable. Store ode data using
concatenation which allows the input to contain multiple values.
Change the plot marker to 'o' for compatibility.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 26 Oct 2016 16:11:56 -0700 |
parents | 305706823a2d |
children | b477f275c12f |
files | scripts/ode/odeplot.m |
diffstat | 1 files changed, 4 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ode/odeplot.m Wed Oct 26 10:19:51 2016 -0700 +++ b/scripts/ode/odeplot.m Wed Oct 26 16:11:56 2016 -0700 @@ -75,16 +75,14 @@ ## No input argument checking is done for better performance persistent hlines num_lines told yold; - persistent idx = 1; # Don't remove. Required for Octave parser. ## odeplot never stops the integration stop_solve = false; if (isempty (flag)) ## Default case, plot and return a value - idx += 1; - told(idx,1) = t(1,1); - yold(:,idx) = y(:,1); + told = [told; t(:)]; + yold = [yold, y]; for i = 1:num_lines set (hlines(i), "xdata", told, "ydata", yold(i,:)); endfor @@ -95,11 +93,10 @@ elseif (strcmp (flag, "init")) ## t is either the time slot [tstart tstop] or [t0, t1, ..., tn] ## y is the initial value vector for the ode solution - idx = 1; - told = t(1,1); + told = t(1); yold = y(:,1); figure (); - hlines = plot (told, yold, "-", "marker", ".", "markersize", 9); + hlines = plot (told, yold, "o-"); xlim ([t(1), t(end)]); # Fix limits which also speeds up plotting num_lines = numel (hlines);