From: <car...@us...> - 2011-11-05 14:03:14
|
Revision: 8996 http://octave.svn.sourceforge.net/octave/?rev=8996&view=rev Author: carandraug Date: 2011-11-05 14:03:07 +0000 (Sat, 05 Nov 2011) Log Message: ----------- signal package: * use print_usage * use ... instead of \ as continuation line * small fixes on help text * set defaults in the function definition line Modified Paths: -------------- trunk/octave-forge/main/signal/inst/downsample.m trunk/octave-forge/main/signal/inst/dst.m trunk/octave-forge/main/signal/inst/idst.m trunk/octave-forge/main/signal/inst/upsample.m Modified: trunk/octave-forge/main/signal/inst/downsample.m =================================================================== --- trunk/octave-forge/main/signal/inst/downsample.m 2011-11-05 14:02:06 UTC (rev 8995) +++ trunk/octave-forge/main/signal/inst/downsample.m 2011-11-05 14:03:07 UTC (rev 8996) @@ -2,26 +2,27 @@ ## This function is public domain ## -*- texinfo -*- -## @deftypefn {Function File} @var{y} = downsample(@var{x},@var{n}) +## @deftypefn {Function File} {@var{y} =} downsample (@var{x}, @var{n}) +## @deftypefnx {Function File} {@var{y} =} downsample (@var{x}, @var{n}, @var{offset}) ## Downsample the signal, selecting every nth element. If @var{x} ## is a matrix, downsample every column. ## -## For most signals you will want to use decimate() instead since +## For most signals you will want to use @code{decimate} instead since ## it prefilters the high frequency components of the signal and ## avoids aliasing effects. ## -## @deftypefnx {Function File} @var{y} = downsample(@var{x},@var{n},@var{offset}) -## Select every nth element starting at sample @var{offset}. +## If @var{offset} is defined, select every nth element starting at +## sample @var{offset}. +## @seealso{decimate, interp, resample, upfirdn, upsample} ## @end deftypefn -## @seealso{decimate, interp, resample, upfirdn, upsample} -function y = downsample(x,n,phase) - if nargin<2 || nargin>3, usage('downsample(x,n,[offset]'); end - if nargin==2, phase = 0; end +function y = downsample (x, n, phase = 0) + if nargin<2 || nargin>3, print_usage; end + if phase > n - 1 - warning("This is incompatible with Matlab (phase = 0:n-1). See\ - octave-forge signal package release notes for details." ) + warning("This is incompatible with Matlab (phase = 0:n-1). See ... + octave-forge signal package release notes for details.") end if isvector(x) Modified: trunk/octave-forge/main/signal/inst/dst.m =================================================================== --- trunk/octave-forge/main/signal/inst/dst.m 2011-11-05 14:02:06 UTC (rev 8995) +++ trunk/octave-forge/main/signal/inst/dst.m 2011-11-05 14:03:07 UTC (rev 8996) @@ -2,8 +2,8 @@ ## This function is public domain ## -*- texinfo -*- -## @deftypefn {Function File} @var{y} = dst (@var{x}) -## @deftypefnx {Function File} @var{y} = dst (@var{x}, @var{n}) +## @deftypefn {Function File} {@var{y} =} dst (@var{x}) +## @deftypefnx {Function File} {@var{y} =} dst (@var{x}, @var{n}) ## Computes the type I discrete sine transform of @var{x}. If @var{n} is given, ## then @var{x} is padded or trimmed to length @var{n} before computing the transform. ## If @var{x} is a matrix, compute the transform along the columns of the @@ -11,17 +11,19 @@ ## ## The discrete sine transform X of x can be defined as follows: ## +## @verbatim ## N ## X[k] = sum x[n] sin (pi n k / (N+1) ), k = 1, ..., N ## n=1 +## @end verbatim ## +## @seealso{idst} ## @end deftypefn -## @seealso{idst} function y = dst (x, n) if (nargin < 1 || nargin > 2) - usage ("y = dst(x [, n])"); + print_usage; endif transpose = (rows (x) == 1); @@ -48,10 +50,8 @@ if transpose, y = y.'; endif - endfunction - %!test %! x = log(linspace(0.1,1,32)); %! y = dst(x); Modified: trunk/octave-forge/main/signal/inst/idst.m =================================================================== --- trunk/octave-forge/main/signal/inst/idst.m 2011-11-05 14:02:06 UTC (rev 8995) +++ trunk/octave-forge/main/signal/inst/idst.m 2011-11-05 14:03:07 UTC (rev 8996) @@ -2,19 +2,19 @@ ## This function is public domain ## -*- texinfo -*- -## @deftypefn {Function File} @var{y} = idst (@var{x}) -## @deftypefnx {Function File} @var{y} = idst (@var{x}, @var{n}) +## @deftypefn {Function File} {@var{y} =} idst (@var{x}) +## @deftypefnx {Function File} {@var{y} =} idst (@var{x}, @var{n}) ## Computes the inverse type I discrete sine transform of @var{y}. If @var{n} is ## given, then @var{y} is padded or trimmed to length @var{n} before computing ## the transform. If @var{y} is a matrix, compute the transform along the ## columns of the the matrix. +## @seealso{dst} ## @end deftypefn -## @seealso{dst} function x = idst (y, n) if (nargin < 1 || nargin > 2) - usage ("x = idst(y [, n])"); + print_usage; endif if nargin == 1, Modified: trunk/octave-forge/main/signal/inst/upsample.m =================================================================== --- trunk/octave-forge/main/signal/inst/upsample.m 2011-11-05 14:02:06 UTC (rev 8995) +++ trunk/octave-forge/main/signal/inst/upsample.m 2011-11-05 14:03:07 UTC (rev 8996) @@ -2,21 +2,22 @@ ## This function is public domain ## -*- texinfo -*- -## @deftypefn {Function File} @var{y} = upsample(@var{x},@var{n}) -## Upsample the signal, inserting n-1 zeros between every element. +## @deftypefn {Function File} {@var{y} =} upsample (@var{x}, @var{n}) +## @deftypefnx {Function File} {@var{y} =} upsample (@var{x}, @var{n}, @var{offset}) +## Upsample the signal, inserting n-1 zeros between every element. +## ## If @var{x} is a matrix, upsample every column. ## -## @deftypefnx {Function File} @var{y} = upsample(@var{x},@var{n},@var{offset}) -## Control the position of the inserted sample in the block of n zeros. +## If @var{offset} is specified, control the position of the inserted sample in +## the block of n zeros. +## @seealso{decimate, downsample, interp, resample, upfirdn} ## @end deftypefn -## @seealso{decimate, downsample, interp, resample, upfirdn} -function y = upsample(x,n,phase) - if nargin<2 || nargin>3, usage('upsample(x,n,[phase]'); end - if nargin==2, phase = 0; end +function y = upsample (x, n, phase = 0) + if nargin<2 || nargin>3, print_usage; end if phase > n - 1 - warning("This is incompatible with Matlab (phase = 0:n-1). See\ + warning("This is incompatible with Matlab (phase = 0:n-1). See ... octave-forge signal package release notes for details." ) end @@ -36,4 +37,3 @@ %!assert(upsample([1,2;5,6;9,10],2),[1,2;0,0;5,6;0,0;9,10;0,0]); %!assert(upsample([2,4],2,1),[0,2,0,4]); %!assert(upsample([3,4;7,8],2,1),[0,0;3,4;0,0;7,8]); - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |