%!demo
%! ## Plot various iCDFs from the Poisson distribution
%! p = 0.001:0.001:0.999;
%! data1 = poissrnd (2, 10000, 1);
%! data2 = poissrnd (5, 10000, 1);
%! data3 = poissrnd (10, 10000, 1);
%! pd1 = fitdist (data1, "Poisson");
%! pd2 = fitdist (data2, "Poisson");
%! pd3 = fitdist (data3, "Poisson");
%! 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 ({"lambda = 2", "lambda = 5", "lambda = 10"}, "location", "northwest")
%! title ("Poisson iCDF")
%! xlabel ("Probability")
%! ylabel ("values in x (non-negative integers)")
%!
%! ## This demonstrates the inverse CDF (quantiles) for Poisson distributions,
%! ## useful for finding the number of events corresponding to a given probability,
%! ## such as in inventory management for stock levels.
