comparison scripts/statistics/distributions/binocdf.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
comparison
equal deleted inserted replaced
10548:479536c5bb10 10549:95c3e38098bf
40 40
41 sz = size (x); 41 sz = size (x);
42 cdf = zeros (sz); 42 cdf = zeros (sz);
43 43
44 k = find (isnan (x) | !(n >= 0) | (n != round (n)) 44 k = find (isnan (x) | !(n >= 0) | (n != round (n))
45 | !(p >= 0) | !(p <= 1)); 45 | !(p >= 0) | !(p <= 1));
46 if (any (k)) 46 if (any (k))
47 cdf(k) = NaN; 47 cdf(k) = NaN;
48 endif 48 endif
49 49
50 k = find ((x >= n) & (n >= 0) & (n == round (n)) 50 k = find ((x >= n) & (n >= 0) & (n == round (n))
51 & (p >= 0) & (p <= 1)); 51 & (p >= 0) & (p <= 1));
52 if (any (k)) 52 if (any (k))
53 cdf(k) = 1; 53 cdf(k) = 1;
54 endif 54 endif
55 55
56 k = find ((x >= 0) & (x < n) & (n == round (n)) 56 k = find ((x >= 0) & (x < n) & (n == round (n))
57 & (p >= 0) & (p <= 1)); 57 & (p >= 0) & (p <= 1));
58 if (any (k)) 58 if (any (k))
59 tmp = floor (x(k)); 59 tmp = floor (x(k));
60 if (isscalar (n) && isscalar (p)) 60 if (isscalar (n) && isscalar (p))
61 cdf(k) = 1 - betainc (p, tmp + 1, n - tmp); 61 cdf(k) = 1 - betainc (p, tmp + 1, n - tmp);
62 else 62 else