%!demo
%! ## Plot various iCDFs from the Binomial distribution
%! p = 0.001:0.001:0.999;
%! pd1 = makedist ("Binomial", "N", 10, "p", 0.2);
%! pd2 = makedist ("Binomial", "N", 10, "p", 0.5);
%! pd3 = makedist ("Binomial", "N", 10, "p", 0.8);
%! x1 = icdf (pd1, p);
%! x2 = icdf (pd2, p);
%! x3 = icdf (pd3, p);
%! plot (p, x1, ".b", p, x2, ".g", p, x3, ".r")
%! grid on
%! legend ({"N = 10, p = 0.2", "N = 10, p = 0.5", "N = 10, p = 0.8"}, ...
%!          "location", "northwest")
%! title ("Binomial iCDF")
%! xlabel ("Probability")
%! ylabel ("Number of successes")
%!
%! ## This demonstrates the inverse CDF (quantiles) for binomial distributions,
%! ## useful for finding the number of successes corresponding to given
%! ## probabilities.
