Categories &

Functions List

Function Reference: binocdf

statistics: p = binocdf (x, n, ps)
statistics: p = binocdf (x, n, ps, 'upper')

Binomial cumulative distribution function (CDF).

For each element of x, compute the cumulative distribution function (CDF) of the binomial distribution with parameters n and ps, where n is the number of trials and ps is the probability of success. The size of p is the common size of x, n, and ps. A scalar input functions as a constant matrix of the same size as the other inputs.

p = binocdf (x, n, ps, "upper") computes the upper tail probability of the binomial distribution with parameters n and ps, at the values in x.

Further information about the binomial distribution can be found at https://en.wikipedia.org/wiki/Binomial_distribution

See also: binoinv, binopdf, binornd, binofit, binolike, binostat, binotest

Source Code: binocdf

Example: 1

Plot various CDFs from the binomial distribution

 x = 0:40;
 p1 = binocdf (x, 20, 0.5);
 p2 = binocdf (x, 20, 0.7);
 p3 = binocdf (x, 40, 0.5);
 plot (x, p1, '*b', x, p2, '*g', x, p3, '*r')
 grid on
 legend ({'n = 20, ps = 0.5', 'n = 20, ps = 0.7', ...
          'n = 40, ps = 0.5'}, 'location', 'southeast')
 title ('Binomial CDF')
 xlabel ('values in x (number of successes)')
 ylabel ('probability')
plotted figure