Mercurial > octave-antonio
diff scripts/statistics/distributions/cauchy_rnd.m @ 11587:c792872f8942
all script files: untabify and strip trailing whitespace
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 20 Jan 2011 17:35:29 -0500 |
parents | fd0a3ac60b0e |
children | 19b9f17d22af |
line wrap: on
line diff
--- a/scripts/statistics/distributions/cauchy_rnd.m Thu Jan 20 17:24:59 2011 -0500 +++ b/scripts/statistics/distributions/cauchy_rnd.m Thu Jan 20 17:35:29 2011 -0500 @@ -19,8 +19,8 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} cauchy_rnd (@var{location}, @var{scale}, @var{r}, @var{c}) ## @deftypefnx {Function File} {} cauchy_rnd (@var{location}, @var{scale}, @var{sz}) -## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of -## random samples from the Cauchy distribution with parameters @var{location} +## Return an @var{r} by @var{c} or a @code{size (@var{sz})} matrix of +## random samples from the Cauchy distribution with parameters @var{location} ## and @var{scale} which must both be scalar or of size @var{r} by @var{c}. ## ## If @var{r} and @var{c} are omitted, the size of the result matrix is @@ -33,7 +33,7 @@ function rnd = cauchy_rnd (location, scale, r, c) if (nargin > 1) - if (!isscalar (location) || !isscalar (scale)) + if (!isscalar (location) || !isscalar (scale)) [retval, location, scale] = common_size (location, scale); if (retval > 0) error ("cauchy_rnd: LOCATION and SCALE must be of common size or scalar"); @@ -75,7 +75,7 @@ print_usage (); endif - if (isscalar (location) && isscalar (scale)) + if (isscalar (location) && isscalar (scale)) if (find (!(location > -Inf) | !(location < Inf) | !(scale > 0) | !(scale < Inf))) rnd = NaN (sz); @@ -84,7 +84,7 @@ endif else rnd = NaN (sz); - k = find ((location > -Inf) & (location < Inf) + k = find ((location > -Inf) & (location < Inf) & (scale > 0) & (scale < Inf)); if (any (k)) rnd(k) = location(k)(:) - cot (pi * rand (size (k))) .* scale(k)(:);