# HG changeset patch # User Carlo de Falco # Date 1450422840 -3600 # Node ID d9e05450936fe81077833c84c34182f5d810d069 # Parent 8d82da0f34397e8aebbfd72059df52a2d1f64bdd cleanup odeplot style * scripts/ode/odeplot.m: use '##' instead of '%#', don't use varargout as only one output is ever used. diff -r 8d82da0f3439 -r d9e05450936f scripts/ode/odeplot.m --- a/scripts/ode/odeplot.m Fri Dec 18 08:08:38 2015 +0100 +++ b/scripts/ode/odeplot.m Fri Dec 18 08:14:00 2015 +0100 @@ -18,33 +18,33 @@ ## Author: Thomas Treichl -%# -*- texinfo -*- -%# @deftypefn {} {[@var{ret}] =} odeplot (@var{t}, @var{y}, @var{flag}) -%# -%# Open a new figure window and plot the results from the variable @var{y} of type column vector over time while solving. The types and the values of the input parameter @var{t} and the output parameter @var{ret} depend on the input value @var{flag} that is of type string. If @var{flag} is -%# @table @option -%# @item @code{"init"} -%# then @var{t} must be a double column vector of length 2 with the first and the last time step and nothing is returned from this function, -%# @item @code{""} -%# then @var{t} must be a double scalar specifying the actual time step and the return value is false (resp. value 0) for 'not stop solving', -%# @item @code{"done"} -%# then @var{t} must be a double scalar specifying the last time step and nothing is returned from this function. -%# @end table -%# -%# This function is called by a ode solver function if it was specified in an options structure with the @command{odeset}. This function is an internal helper function therefore it should never be necessary that this function is called directly by a user. There is only little error detection implemented in this function file to achieve the highest performance. -%# -%# For example, solve an anonymous implementation of the "Van der Pol" equation and display the results while solving -%# @example -%# fvdb = @@(t,y) [y(2); (1 - y(1)^2) * y(2) - y(1)]; -%# -%# opt = odeset ("OutputFcn", @@odeplot, "RelTol", 1e-6); -%# sol = ode45 (fvdb, [0 20], [2 0], opt); -%# @end example -%# @end deftypefn -%# -%# @seealso{odeset,odeget} +## -*- texinfo -*- +## @deftypefn {} {[@var{ret}] =} odeplot (@var{t}, @var{y}, @var{flag}) +## +## Open a new figure window and plot the results from the variable @var{y} of type column vector over time while solving. The types and the values of the input parameter @var{t} and the output parameter @var{ret} depend on the input value @var{flag} that is of type string. If @var{flag} is +## @table @option +## @item @code{"init"} +## then @var{t} must be a double column vector of length 2 with the first and the last time step and nothing is returned from this function, +## @item @code{""} +## then @var{t} must be a double scalar specifying the actual time step and the return value is false (resp. value 0) for 'not stop solving', +## @item @code{"done"} +## then @var{t} must be a double scalar specifying the last time step and nothing is returned from this function. +## @end table +## +## This function is called by a ode solver function if it was specified in an options structure with the @command{odeset}. This function is an internal helper function therefore it should never be necessary that this function is called directly by a user. There is only little error detection implemented in this function file to achieve the highest performance. +## +## For example, solve an anonymous implementation of the "Van der Pol" equation and display the results while solving +## @example +## fvdb = @@(t,y) [y(2); (1 - y(1)^2) * y(2) - y(1)]; +## +## opt = odeset ("OutputFcn", @@odeplot, "RelTol", 1e-6); +## sol = ode45 (fvdb, [0 20], [2 0], opt); +## @end example +## @end deftypefn +## +## @seealso{odeset,odeget} -function [varargout] = odeplot (t, y, flag, varargin) +function ret = odeplot (t, y, flag, varargin) ## No input argument check is done for a higher processing speed persistent fig; persistent told; @@ -57,13 +57,13 @@ counter = 1; elseif (isempty (flag)) - ## Return something in varargout{1}, either false for "not stopping + ## Return something, either false for "not stopping ## the integration" or true for "stopping the integration" counter = counter + 1; figure (fig); told(counter,1) = t(1,1); yold(:,counter) = y(:,1); plot (told, yold, "-o", "markersize", 1); drawnow; - varargout{1} = false; + ret = false; elseif (strcmp (flag, "done")) ## Cleanup has to be done, clear the persistent variables because