From: <car...@us...> - 2012-08-27 01:52:02
|
Revision: 10920 http://octave.svn.sourceforge.net/octave/?rev=10920&view=rev Author: carandraug Date: 2012-08-27 01:51:54 +0000 (Mon, 27 Aug 2012) Log Message: ----------- xcorr2: fix bug when no arguments are passed Modified Paths: -------------- trunk/octave-forge/main/signal/inst/xcorr2.m Modified: trunk/octave-forge/main/signal/inst/xcorr2.m =================================================================== --- trunk/octave-forge/main/signal/inst/xcorr2.m 2012-08-26 19:32:20 UTC (rev 10919) +++ trunk/octave-forge/main/signal/inst/xcorr2.m 2012-08-27 01:51:54 UTC (rev 10920) @@ -21,8 +21,8 @@ ## @deftypefnx {Function File} {@var{c} =} xcorr2 (@dots{}, @var{scale}) ## Compute the 2D cross-correlation of matrices @var{a} and @var{b}. ## -## If @var{b} is not specified, it defaults to the same matrix as @var{a}, i.e., -## same as @code{xcorr(@var{a}, @var{a})}. +## If @var{b} is not specified, computes autocorrelation of @var{a}, i.e., +## same as @code{xcorr (@var{a}, @var{a})}. ## ## The optional argument @var{scale}, defines the type of scaling applied to the ## cross-correlation matrix. Possible values are: @@ -51,13 +51,18 @@ ## @seealso{conv2, corr2, xcorr} ## @end deftypefn -function c = xcorr2 (a, b = a, biasflag = "none") +function c = xcorr2 (a, b, biasflag = "none") if (nargin < 1 || nargin > 3) print_usage; elseif (nargin == 2 && ischar (b)) biasflag = b; b = a; + elseif (nargin == 1) + ## we have to set this case here instead of the function line, because if + ## someone calls the function with zero argument, since a is never set, we + ## will fail with "`a' undefined" error rather that print_usage + b = a; endif ## compute correlation This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |