changeset 31265:c332a2f2959f

Clean up odeplot tests and demos (bug #63063) * ode23.m, ode23s.m, ode45.m: Remove odeplot tests. * odeplot.m: Convert inpot syntax test into a demo.
author Ken Marek <marek_ka@mercer.edu>
date Thu, 06 Oct 2022 16:36:29 -0400
parents af3752d9a59f
children 3c504176e546
files scripts/ode/ode23.m scripts/ode/ode23s.m scripts/ode/ode45.m scripts/ode/odeplot.m
diffstat 4 files changed, 27 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ode/ode23.m	Wed Oct 05 22:26:22 2022 -0400
+++ b/scripts/ode/ode23.m	Thu Oct 06 16:36:29 2022 -0400
@@ -504,12 +504,6 @@
 %! [x, y] = ode23 (@(x,y) 1, [0 1], 1i);
 %! assert (imag (y), ones (size (y)));
 
-## FIXME: convert to demo or a visible=off test with failable assert/error
-##        statemments
-##%!test # Make sure odeplot works (default OutputFcn when no return value)
-##%! ode23 (@fpol, [0 2], [2 0]);
-##%! close all
-
 ## Test input validation
 %!error <Invalid call> ode23 ()
 %!error <Invalid call> ode23 (1)
--- a/scripts/ode/ode23s.m	Wed Oct 05 22:26:22 2022 -0400
+++ b/scripts/ode/ode23s.m	Thu Oct 06 16:36:29 2022 -0400
@@ -504,12 +504,6 @@
 %! [x, y] = ode23s (@(x,y) 1, [0 1], 1i);
 %! assert (imag (y), ones (size (y)));
 
-## FIXME: convert to demo or a visible=off test with failable assert/error
-##        statemments
-##%!test # Make sure odeplot works (default OutputFcn when no return value)
-##%! ode23s (@fpol, [0 2], [2 0]);
-##%! close all
-
 ## Test input validation
 %!error <Invalid call> ode23s ()
 %!error <Invalid call> ode23s (1)
--- a/scripts/ode/ode45.m	Wed Oct 05 22:26:22 2022 -0400
+++ b/scripts/ode/ode45.m	Thu Oct 06 16:36:29 2022 -0400
@@ -516,12 +516,6 @@
 %! [x, y] = ode45 (@(x,y) 1, [0 1], 1i, odeset ("Refine", 1));
 %! assert (imag (y), ones (size (y)));
 
-## FIXME: convert to demo or a visible=off test with failable assert/error
-##        statemments
-##%!test # Make sure odeplot works (default OutputFcn when no return value)
-##%! ode45 (@fpol, [0 2], [2 0]);
-##%! close all
-
 %!error <Invalid call> ode45 ()
 %!error <Invalid call> ode45 (1)
 %!error <Invalid call> ode45 (1,2)
--- a/scripts/ode/odeplot.m	Wed Oct 05 22:26:22 2022 -0400
+++ b/scripts/ode/odeplot.m	Thu Oct 06 16:36:29 2022 -0400
@@ -118,17 +118,31 @@
 %! ## Solve an anonymous implementation of the Van der Pol equation
 %! ## and display the results while solving
 %! fvdp = @(t,y) [y(2); (1 - y(1)^2) * y(2) - y(1)];
-%! opt = odeset ("OutputFcn", @odeplot, "RelTol", 1e-6);
-%! sol = ode45 (fvdp, [0 20], [2 0], opt);
+%! opt = odeset ("RelTol", 1e-6);
+%! ode45 (fvdp, [0 20], [2 0], opt);
 
-## FIXME: convert to demo or a visible=off test with failable assert/error
-##        statemments
-## Test that the function works for expected ode OutputFcn calls
-## %!test
-## %! t = linspace(0,2,10);
-## %! y = [0.2*t; -0.1*t.^2-1; sin(t)];
-## %! odeplot ([0 2], y(:,1), "init");
-## %! odeplot (t(2), y(:,2), []);
-## %! odeplot (t(3:end), y(:, 3:end), []);
-## %! odeplot ([], [], "done");
-## %! close all
+%!demo
+%! ## Demonstrate simple multi-curve plot from t = 0 to 2 using initial,
+%! ## intermediate, and terminating odeplot calling syntaxes.
+%! t = linspace(0,2,10);
+%! y = [0.2*t; -0.1*t.^2-1; sin(t)];
+%!
+%! disp("Plot initial points\n");
+%! odeplot ([0 2], y(:,1), "init");
+%! title("Plot first time step");
+%! pause(1.5);
+%!
+%! disp("Append single time step\n");
+%! odeplot (t(2), y(:,2), []);
+%! title("Append second time step");
+%! pause(1.5);
+%!
+%! disp("Append remaining time steps\n");
+%! odeplot (t(3:end), y(:, 3:end), []);
+%! title("Plot all time steps");
+%! pause(1.5);
+%!
+%! disp("Terminate odeplot\n");
+%! odeplot ([], [], "done");
+%! title("Plot complete");
+