Mercurial > octave-nkf
diff scripts/statistics/distributions/nbincdf.m @ 10549:95c3e38098bf
Untabify .m scripts
author | Rik <code@nomad.inbox5.com> |
---|---|
date | Fri, 23 Apr 2010 11:28:50 -0700 |
parents | a1dbe9d80eee |
children | 1740012184f9 |
line wrap: on
line diff
--- a/scripts/statistics/distributions/nbincdf.m Fri Apr 23 11:13:48 2010 -0700 +++ b/scripts/statistics/distributions/nbincdf.m Fri Apr 23 11:28:50 2010 -0700 @@ -45,19 +45,19 @@ cdf = zeros (size (x)); k = find (isnan (x) | (n < 1) | (n == Inf) | (n != round (n)) - | (p < 0) | (p > 1)); + | (p < 0) | (p > 1)); if (any (k)) cdf(k) = NaN; endif k = find ((x == Inf) & (n > 0) & (n < Inf) & (n == round (n)) - & (p >= 0) & (p <= 1)); + & (p >= 0) & (p <= 1)); if (any (k)) cdf(k) = 1; endif k = find ((x >= 0) & (x < Inf) & (x == round (x)) & (n > 0) - & (n < Inf) & (n == round (n)) & (p > 0) & (p <= 1)); + & (n < Inf) & (n == round (n)) & (p > 0) & (p <= 1)); if (any (k)) ## Does anyone know a better way to do the summation? m = zeros (size (k)); @@ -65,25 +65,25 @@ y = cdf(k); if (isscalar (n) && isscalar (p)) while (1) - l = find (m <= x); - if (any (l)) + l = find (m <= x); + if (any (l)) y(l) = y(l) + nbinpdf (m(l), n, p); m(l) = m(l) + 1; - else + else break; - endif + endif endwhile else n = n(k); p = p(k); while (1) - l = find (m <= x); - if (any (l)) + l = find (m <= x); + if (any (l)) y(l) = y(l) + nbinpdf (m(l), n(l), p(l)); m(l) = m(l) + 1; - else + else break; - endif + endif endwhile endif cdf(k) = y;