# HG changeset patch # User Nicholas R. Jankowski # Date 1714714747 14400 # Node ID 54aa0f0a89db1a33e2383d8b9378e4fc1f6316bc # Parent d1ecff72ff5b38d742d75d6246fc8b5664a8ea9b ode23s.m: change calls to tic within demos to variable assignments (bug #65668) * ode23s.m: Replace tic / toc calls in demos with tmr = tic, toc (tmr) calls to avoid resetting global timer. diff -r d1ecff72ff5b -r 54aa0f0a89db scripts/ode/ode23s.m --- a/scripts/ode/ode23s.m Thu May 02 20:10:11 2024 -0400 +++ b/scripts/ode/ode23s.m Fri May 03 01:39:07 2024 -0400 @@ -277,9 +277,9 @@ %! ## Demo function: stiff Van Der Pol equation %! fcn = @(t,y) [y(2); 10*(1-y(1)^2)*y(2)-y(1)]; %! ## Calling ode23s method -%! tic () +%! tmr = tic (); %! [vt, vy] = ode23s (fcn, [0 20], [2 0]); -%! toc () +%! toc (tmr); %! ## Plotting the result %! plot (vt,vy(:,1),'-o'); @@ -289,9 +289,9 @@ %! ## Calling ode23s method %! odeopts = odeset ("Jacobian", @(t,y) [0 1; -20*y(1)*y(2)-1, 10*(1-y(1)^2)], %! "InitialStep", 1e-3) -%! tic () +%! tmr = tic (); %! [vt, vy] = ode23s (fcn, [0 20], [2 0], odeopts); -%! toc () +%! toc (tmr); %! ## Plotting the result %! plot (vt,vy(:,1),'-o'); @@ -300,9 +300,9 @@ %! fcn = @(t,y) [y(2); 100*(1-y(1)^2)*y(2)-y(1)]; %! ## Calling ode23s method %! odeopts = odeset ("InitialStep", 1e-4); -%! tic () +%! tmr = tic (); %! [vt, vy] = ode23s (fcn, [0 200], [2 0]); -%! toc () +%! toc (tmr); %! ## Plotting the result %! plot (vt,vy(:,1),'-o'); @@ -312,9 +312,9 @@ %! ## Calling ode23s method %! odeopts = odeset ("Jacobian", @(t,y) [0 1; -200*y(1)*y(2)-1, 100*(1-y(1)^2)], %! "InitialStep", 1e-4); -%! tic () +%! tmr = tic (); %! [vt, vy] = ode23s (fcn, [0 200], [2 0], odeopts); -%! toc () +%! toc (tmr); %! ## Plotting the result %! plot (vt,vy(:,1),'-o');