Mercurial > hg > octave-lyh
changeset 16491:b10a23fe80bb
doc: Tweak docstrings of functions changed for Texinfo 5.0 compatibility.
* scripts/audio/wavread.m, scripts/miscellaneous/getappdata.m,
scripts/miscellaneous/license.m, scripts/miscellaneous/ver.m,
scripts/plot/daspect.m, scripts/plot/graphics_toolkit.m,
scripts/plot/pbaspect.m, scripts/polynomial/splinefit.m, scripts/set/union.m,
scripts/signal/freqz.m: Improve docstring wording.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 10 Apr 2013 22:43:30 -0700 |
parents | f50fe9c50f55 |
children | 91c32a702284 |
files | scripts/audio/wavread.m scripts/miscellaneous/getappdata.m scripts/miscellaneous/license.m scripts/miscellaneous/ver.m scripts/plot/daspect.m scripts/plot/graphics_toolkit.m scripts/plot/pbaspect.m scripts/polynomial/splinefit.m scripts/set/union.m scripts/signal/freqz.m |
diffstat | 10 files changed, 146 insertions(+), 121 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/audio/wavread.m +++ b/scripts/audio/wavread.m @@ -17,10 +17,10 @@ ## <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {@var{y} =} wavread (@var{filename}) +## @deftypefn {Function File} {@var{y} =} wavread (@var{filename}) ## @deftypefnx {Function File} {[@var{y}, @var{Fs}, @var{bps}] =} wavread (@var{filename}) ## @deftypefnx {Function File} {[@dots{}] =} wavread (@var{filename}, @var{n}) -## @deftypefnx {Function File} {[@dots{}] =} wavread (@var{filename}, @var{n1} @var{n2}) +## @deftypefnx {Function File} {[@dots{}] =} wavread (@var{filename}, [@var{n1} @var{n2}]) ## @deftypefnx {Function File} {[@var{samples}, @var{channels}] =} wavread (@var{filename}, "size") ## ## Load the RIFF/WAVE sound file @var{filename}, and return the samples @@ -28,17 +28,21 @@ ## @var{y} is a matrix with the channels represented as columns. ## ## @code{[@var{y}, @var{Fs}, @var{bps}] = wavread (@var{filename})} +## ## Additionally return the sample rate (@var{fs}) in Hz and the number of bits ## per sample (@var{bps}). ## ## @code{[@dots{}] = wavread (@var{filename}, @var{n})} +## ## Read only the first @var{n} samples from each channel. ## -## @code{wavread (@var{filename}, @var{n1} @var{n2})} +## @code{wavread (@var{filename}, [@var{n1} @var{n2}])} +## ## Read only samples @var{n1} through @var{n2} from each channel. ## ## @code{[@var{samples}, @var{channels}] = wavread (@var{filename}, "size")} -## Return the number of samples (@var{n}) and channels (@var{ch}) +## +## Return the number of samples (@var{n}) and number of channels (@var{ch}) ## instead of the audio data. ## @seealso{wavwrite} ## @end deftypefn
--- a/scripts/miscellaneous/getappdata.m +++ b/scripts/miscellaneous/getappdata.m @@ -15,14 +15,14 @@ ## <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {@var{value} =} getappdata (@var{h}, @var{name}) +## @deftypefn {Function File} {@var{value} =} getappdata (@var{h}, @var{name}) ## @deftypefnx {Function File} {@var{appdata} =} getappdata (@var{h}) ## ## Return the @var{value} for named application data for the object(s) with ## handle(s) @var{h}. ## -## @code{getappdata(@var{h})} returns a structure, @var{appdata}, whose fields correspond to the appdata -## properties. +## @code{getappdata(@var{h})} returns a structure, @var{appdata}, whose fields +## correspond to the appdata properties. ## @end deftypefn ## Author: Ben Abbott <bpabbott@mac.com>
--- a/scripts/miscellaneous/license.m +++ b/scripts/miscellaneous/license.m @@ -17,7 +17,7 @@ ## <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {} license +## @deftypefn {Command} {} license ## @deftypefnx {Function File} {} license ("inuse") ## @deftypefnx {Function File} {@var{retval} =} license ("inuse") ## @deftypefnx {Function File} {@var{retval} =} license ("test", @var{feature}) @@ -27,17 +27,21 @@ ## Display the license of Octave. ## ## @code{license ("inuse")} +## ## Display a list of packages currently being used. ## ## @code{@var{retval} = license ("inuse")} +## ## Return a structure containing the fields @code{feature} and @code{user}. ## ## @code{@var{retval} = license ("test", @var{feature})} +## ## Return 1 if a license exists for the product identified by the string ## @var{feature} and 0 otherwise. The argument @var{feature} is case ## insensitive and only the first 27 characters are checked. ## ## @code{license ("test", @var{feature}, @var{toggle})} +## ## Enable or disable license testing for @var{feature}, depending on ## @var{toggle}, which may be one of: ## @@ -51,6 +55,7 @@ ## @end table ## ## @code{@var{retval} = license ("checkout", @var{feature})} +## ## Check out a license for @var{feature}, returning 1 on success and 0 ## on failure. ##
--- a/scripts/miscellaneous/ver.m +++ b/scripts/miscellaneous/ver.m @@ -17,17 +17,18 @@ ## <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {} ver () +## @deftypefn {Function File} {} ver () ## @deftypefnx {Function File} {v =} ver () ## @deftypefnx {Function File} {v =} ver ("Octave") ## @deftypefnx {Function File} {v =} ver (@var{package}) ## ## Display a header containing the current Octave version number, license -## string and operating system, followed by the installed package names, +## string, and operating system followed by a list of installed packages, ## versions, and installation directories. ## ## @code{v = ver ()} -## Return a vector of structures, respecting Octave and each installed package. +## +## Return a vector of structures describing Octave and each installed package. ## The structure includes the following fields. ## ## @table @code @@ -41,13 +42,15 @@ ## Revision of the package. ## ## @item Date -## Date respecting the version/revision. +## Date of the version/revision. ## @end table ## ## @code{v = ver ("Octave")} +## ## Return version information for Octave only. ## ## @code{v = ver (@var{package})} +## ## Return version information for @var{package}. ## ## @seealso{version, octave_config_info}
--- a/scripts/plot/daspect.m +++ b/scripts/plot/daspect.m @@ -17,23 +17,27 @@ ## <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {} daspect (@var{data_aspect_ratio}) -## @deftypefnx {Function File} {@var{data_aspect_ratio} =} daspect () +## @deftypefn {Function File} {@var{data_aspect_ratio} =} daspect () +## @deftypefnx {Function File} {} daspect (@var{data_aspect_ratio}) ## @deftypefnx {Function File} {} daspect (@var{mode}) ## @deftypefnx {Function File} {@var{data_aspect_ratio_mode} =} daspect ("mode") ## @deftypefnx {Function File} {} daspect (@var{hax}, @dots{}) -## @code{daspect} sets the data aspect ratio of the current axes. The aspect -## ratio is a normalized 3-element vector representing the span of the x, y, and -## z-axes limits. -## -## When called without any arguments it returns data aspect ratio of the current axes. +## Query or set the data aspect ratio of the current axes. The aspect +## ratio is a normalized 3-element vector representing the span of the x, y, +## and z-axis limits. ## -## @code{(daspect (@var{mode}))} sets the data aspect ratio mode of the current axes. +## @code{(daspect (@var{mode}))} +## +## Set the data aspect ratio mode of the current axes. @var{mode} is +## either "auto" or "manual". ## -## @code{daspect ("mode")} returns the data aspect ratio mode of the current axes. +## @code{daspect ("mode")} +## +## Return the data aspect ratio mode of the current axes. ## -## @code{daspect (@var{hax}, @dots{})} uses the axes, with handle @var{hax}, -## instead of the current axes. +## @code{daspect (@var{hax}, @dots{})} +## +## Operate on the axes in handle @var{hax} instead of the current axes. ## ## @seealso{axis, pbaspect, xlim, ylim, zlim} ## @end deftypefn
--- a/scripts/plot/graphics_toolkit.m +++ b/scripts/plot/graphics_toolkit.m @@ -17,23 +17,27 @@ ## <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {@var{name} =} graphics_toolkit () +## @deftypefn {Function File} {@var{name} =} graphics_toolkit () ## @deftypefnx {Function File} {@var{name} =} graphics_toolkit (@var{hlist}) ## @deftypefnx {Function File} {} graphics_toolkit (@var{name}) ## @deftypefnx {Function File} {} graphics_toolkit (@var{hlist}, @var{name}) +## Return the default graphics toolkit. The default graphics toolkit value +## is assigned to new figures. ## -## @code{graphics_toolkit (@var{hlist})} returns the default graphics toolkit. -## The default graphics toolkit value is assigned to new figures. +## @code{graphics_toolkit (@var{hlist})} ## -## @code{graphics_toolkit (@var{name})} returns the graphics toolkits -## for the figures with handles @var{hlist}. +## Return the graphics toolkits for the figures with handles @var{hlist}. +## +## @code{graphics_toolkit (@var{name})} ## -## @code{graphics_toolkit (@var{name})} sets the default graphics toolkit -## to @var{name}. If the toolkit is not already loaded, it is initialized -## by calling the function @code{__init_@var{name}__}. +## Set the default graphics toolkit to @var{name}. If the toolkit is not +## already loaded, it is initialized by calling the function +## @code{__init_@var{name}__}. ## -## @code{graphics_toolkit (@var{hlist}, @var{name})} sets the graphics toolkit -## for the figures with handles @var{hlist} to @var{name}. +## @code{graphics_toolkit (@var{hlist}, @var{name})} +## +## Set the graphics toolkit for the figures with handles @var{hlist} to +## @var{name}. ## ## @seealso{available_graphics_toolkits} ## @end deftypefn
--- a/scripts/plot/pbaspect.m +++ b/scripts/plot/pbaspect.m @@ -17,25 +17,28 @@ ## <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {} pbaspect (@var{plot_box_aspect_ratio}) -## @deftypefnx {Function File} {@var{plot_box_aspect_ratio} =} pbaspect ( ) +## @deftypefn {Function File} {@var{plot_box_aspect_ratio} =} pbaspect ( ) +## @deftypefnx {Function File} {} pbaspect (@var{plot_box_aspect_ratio}) ## @deftypefnx {Function File} {} pbaspect (@var{mode}) ## @deftypefnx {Function File} {@var{plot_box_aspect_ratio_mode} =} pbaspect ("mode") ## @deftypefnx {Function File} {} pbaspect (@var{hax}, @dots{}) -## -## Set the plot box aspect ratio of the current axes. The aspect ratio -## is a normalized 3-element vector representing the rendered lengths of -## the x, y, and z-axes. -## -## When called without any arguments, returns the plot box aspect ratio of -## the current axes. -## -## @code{pbaspect(@var{mode})} sets the plot box aspect ratio mode of the current axes. -## -## @code{pbaspect ("mode")} returns the plot box aspect ratio mode of the current axes. -## -## @code{pbaspect (@var{hax}, @dots{})} uses the axes, with handle @var{hax}, instead -## of the current axes. +## +## Query or set the plot box aspect ratio of the current axes. The aspect +## ratio is a normalized 3-element vector representing the rendered lengths of +## the x, y, and z axes. +## +## @code{pbaspect(@var{mode})} +## +## Set the plot box aspect ratio mode of the current axes. @var{mode} is +## either "auto" or "manual". +## +## @code{pbaspect ("mode")} +## +## Return the plot box aspect ratio mode of the current axes. +## +## @code{pbaspect (@var{hax}, @dots{})} +## +## Operate on the axes in handle @var{hax} instead of the current axes. ## ## @seealso{axis, daspect, xlim, ylim, zlim} ## @end deftypefn
--- a/scripts/polynomial/splinefit.m +++ b/scripts/polynomial/splinefit.m @@ -17,7 +17,7 @@ ## <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {@var{pp} =} splinefit (@var{x}, @var{y}, @var{breaks}) +## @deftypefn {Function File} {@var{pp} =} splinefit (@var{x}, @var{y}, @var{breaks}) ## @deftypefnx {Function File} {@var{pp} =} splinefit (@var{x}, @var{y}, @var{p}) ## @deftypefnx {Function File} {@var{pp} =} splinefit (@dots{}, "periodic", @var{periodic}) ## @deftypefnx {Function File} {@var{pp} =} splinefit (@dots{}, "robust", @var{robust}) @@ -27,7 +27,7 @@ ## ## Fit a piecewise cubic spline with breaks (knots) @var{breaks} to the ## noisy data, @var{x} and @var{y}. @var{x} is a vector, and @var{y} -## a vector or N-D array. If @var{y} is an N-D array, then @var{x}(j) +## is a vector or N-D array. If @var{y} is an N-D array, then @var{x}(j) ## is matched to @var{y}(:,@dots{},:,j). ## ## The fitted spline is returned as a piecewise polynomial, @var{pp}, and @@ -67,7 +67,7 @@ ## Vector of the x-locations of the constraints. ## ## @item "yc" -## Constraining values at the locations, @var{xc}. +## Constraining values at the locations @var{xc}. ## The default is an array of zeros. ## ## @item "cc" @@ -92,6 +92,59 @@ ## @seealso{interp1, unmkpp, ppval, spline, pchip, ppder, ppint, ppjumps} ## @end deftypefn +function pp = splinefit (x, y, breaks, varargin) + if (nargin > 3) + n = cellfun (@ischar, varargin, "uniformoutput", true); + varargin(n) = lower (varargin(n)); + try + props = struct (varargin{:}); + catch + print_usage (); + end_try_catch + else + props = struct (); + endif + fields = fieldnames (props); + for f = 1:numel (fields) + if (! any (strcmp (fields{f}, + {"periodic", "robust", "beta", "order", "constraints"}))) + error ("splinefit:invalidproperty", + "unrecognized property '%s'", fields{f}); + endif + endfor + args = {}; + if (isfield (props, "periodic") && props.periodic) + args{end+1} = "p"; + endif + if (isfield (props, "robust") && props.robust) + args{end+1} = "r"; + endif + if (isfield (props, "beta")) + if (0 < props.beta && props.beta < 1) + args{end+1} = props.beta; + else + error ("splinefit:invalidbeta", "invalid beta parameter (0 < beta < 1)"); + endif + endif + if (isfield (props, "order")) + if (props.order >= 0) + args{end+1} = props.order + 1; + else + error ("splinefit:invalidorder", "invalid order"); + endif + endif + if (isfield (props, "constraints")) + args{end+1} = props.constraints; + endif + if (nargin < 3) + print_usage (); + elseif (! isnumeric (breaks) || ! isvector (breaks)) + print_usage (); + endif + pp = __splinefit__ (x, y, breaks, args{:}); +endfunction + + %!demo %! % Noisy data %! x = linspace (0, 2*pi, 100); @@ -169,59 +222,6 @@ %! axis tight %! ylim auto -function pp = splinefit (x, y, breaks, varargin) - if (nargin > 3) - n = cellfun (@ischar, varargin, "uniformoutput", true); - varargin(n) = lower (varargin(n)); - try - props = struct (varargin{:}); - catch - print_usage (); - end_try_catch - else - props = struct (); - endif - fields = fieldnames (props); - for f = 1:numel (fields) - if (! any (strcmp (fields{f}, - {"periodic", "robust", "beta", "order", "constraints"}))) - error ("splinefit:invalidproperty", - "unrecognized property '%s'", fields{f}); - endif - endfor - args = {}; - if (isfield (props, "periodic") && props.periodic) - args{end+1} = "p"; - endif - if (isfield (props, "robust") && props.robust) - args{end+1} = "r"; - endif - if (isfield (props, "beta")) - if (0 < props.beta && props.beta < 1) - args{end+1} = props.beta; - else - error ("splinefit:invalidbeta", "invalid beta parameter (0 < beta < 1)"); - endif - endif - if (isfield (props, "order")) - if (props.order >= 0) - args{end+1} = props.order + 1; - else - error ("splinefit:invalidorder", "invalid order"); - endif - endif - if (isfield (props, "constraints")) - args{end+1} = props.constraints; - endif - if (nargin < 3) - print_usage (); - elseif (! isnumeric (breaks) || ! isvector (breaks)) - print_usage (); - endif - pp = __splinefit__ (x, y, breaks, args{:}); -endfunction - - %!shared xb, yb, x %! xb = 0:2:10; %! yb = 2*rand (size (xb)) - 1;
--- a/scripts/set/union.m +++ b/scripts/set/union.m @@ -23,7 +23,7 @@ ## @deftypefnx {Function File} {[@var{c}, @var{ia}, @var{ib}] =} union (@var{a}, @var{b}) ## ## Return the set of elements that are in either of the sets @var{a} and -## @var{b}. @var{a}, @var{b} may be cell arrays of string(s). +## @var{b}. @var{a}, @var{b} may be cell arrays of strings. ## For example: ## ## @example @@ -33,8 +33,8 @@ ## @end group ## @end example ## -## If the optional third input argument is the string "rows" each row of -## the matrices @var{a} and @var{b} will be considered an element of sets. +## If the optional third input argument is the string "rows" then each row of +## the matrices @var{a} and @var{b} will be considered as a single set element. ## For example: ## ## @example @@ -46,9 +46,8 @@ ## @end group ## @end example ## -## -## Return index vectors @var{ia} and @var{ib} such that @code{a(ia)} and -## @code{b(ib)} are disjoint sets whose union is @var{c}. +## The optional outputs @var{ia} and @var{ib} are index vectors such that +## @code{a(ia)} and @code{b(ib)} are disjoint sets whose union is @var{c}. ## ## @seealso{intersect, setdiff, unique} ## @end deftypefn
--- a/scripts/signal/freqz.m +++ b/scripts/signal/freqz.m @@ -17,7 +17,7 @@ ## <http://www.gnu.org/licenses/>. ## -*- texinfo -*- -## @deftypefn {Function File} {[@var{h}, @var{w}] =} freqz (@var{b}, @var{a}, @var{n}, "whole") +## @deftypefn {Function File} {[@var{h}, @var{w}] =} freqz (@var{b}, @var{a}, @var{n}, "whole") ## @deftypefnx {Function File} {@var{h} =} freqz (@var{b}, @var{a}, @var{w}) ## @deftypefnx {Function File} {[@dots{}] =} freqz (@dots{}, @var{Fs}) ## @deftypefnx {Function File} {} freqz (@dots{}) @@ -36,7 +36,15 @@ ## @noindent ## The output value @var{w} is a vector of the frequencies. ## -## If the fourth argument is omitted, the response is evaluated at +## If @var{a} is omitted, the denominator is assumed to be 1 (this +## corresponds to a simple FIR filter). +## +## If @var{n} is omitted, a value of 512 is assumed. +## +## For fastest computation, @var{n} should factor into a small number of +## small primes. +## +## If the fourth argument, "whole", is omitted the response is evaluated at ## frequencies between 0 and ## @ifnottex ## pi. @@ -45,24 +53,19 @@ ## $\pi$. ## @end tex ## -## If @var{n} is omitted, a value of 512 is assumed. -## -## If @var{a} is omitted, the denominator is assumed to be 1 (this -## corresponds to a simple FIR filter). +## @code{freqz (@var{b}, @var{a}, @var{w})} ## -## For fastest computation, @var{n} should factor into a small number of -## small primes. -## -## @code{freqz (@var{b}, @var{a}, @var{w})} ## Evaluate the response at the specific frequencies in the vector @var{w}. ## The values for @var{w} are measured in radians. ## ## @code{[@dots{}] = freqz (@dots{}, @var{Fs})} +## ## Return frequencies in Hz instead of radians assuming a sampling rate ## @var{Fs}. If you are evaluating the response at specific frequencies ## @var{w}, those frequencies should be requested in Hz rather than radians. ## ## @code{freqz (@dots{})} +## ## Plot the pass band, stop band and phase response of @var{h} rather ## than returning them. ## @end deftypefn