Mercurial > hg > octave-terminal
changeset 12749:e7cc2d4a6db3 stable
Fix range of sigma in normal distribution to exclude 0.
* normcdf.m, normpdf.m: Correct 's >= 0' to 's > 0'.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Thu, 16 Jun 2011 21:05:10 -0700 |
parents | 901d466ee55a |
children | 89d41b6aa661 |
files | scripts/statistics/distributions/normcdf.m scripts/statistics/distributions/normpdf.m |
diffstat | 2 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/statistics/distributions/normcdf.m +++ b/scripts/statistics/distributions/normcdf.m @@ -50,18 +50,18 @@ cdf = zeros (sz); if (isscalar (m) && isscalar(s)) - if (find (isinf (m) | isnan (m) | !(s >= 0) | !(s < Inf))) + if (find (isinf (m) | isnan (m) | !(s > 0) | !(s < Inf))) cdf = NaN (sz); else cdf = stdnormal_cdf ((x - m) ./ s); endif else - k = find (isinf (m) | isnan (m) | !(s >= 0) | !(s < Inf)); + k = find (isinf (m) | isnan (m) | !(s > 0) | !(s < Inf)); if (any (k)) cdf(k) = NaN; endif - k = find (!isinf (m) & !isnan (m) & (s >= 0) & (s < Inf)); + k = find (!isinf (m) & !isnan (m) & (s > 0) & (s < Inf)); if (any (k)) cdf(k) = stdnormal_cdf ((x(k) - m(k)) ./ s(k)); endif
--- a/scripts/statistics/distributions/normpdf.m +++ b/scripts/statistics/distributions/normpdf.m @@ -50,18 +50,18 @@ pdf = zeros (sz); if (isscalar (m) && isscalar (s)) - if (find (isinf (m) | isnan (m) | !(s >= 0) | !(s < Inf))) + if (find (isinf (m) | isnan (m) | !(s > 0) | !(s < Inf))) pdf = NaN (sz); else pdf = stdnormal_pdf ((x - m) ./ s) ./ s; endif else - k = find (isinf (m) | isnan (m) | !(s >= 0) | !(s < Inf)); + k = find (isinf (m) | isnan (m) | !(s > 0) | !(s < Inf)); if (any (k)) pdf(k) = NaN; endif - k = find (!isinf (m) & !isnan (m) & (s >= 0) & (s < Inf)); + k = find (!isinf (m) & !isnan (m) & (s > 0) & (s < Inf)); if (any (k)) pdf(k) = stdnormal_pdf ((x(k) - m(k)) ./ s(k)) ./ s(k); endif