MATLAB Examples

Compute and Plot Hypergeometric Distribution CDF

This example shows how to compute and plot the cdf of a hypergeometric distribution.

Compute the cdf of a hypergeometric distribution that draws 20 samples from a group of 1000 items, when the group contains 50 items of the desired type.

x = 0:10;
y = hygecdf(x,1000,50,20);

Plot the cdf.

stairs(x,y)

The x-axis of the plot shows the number of items drawn that are of the desired type. The y-axis shows the corresponding cdf values.