%!demo
%! ## Plot various iCDFs from the Normal distribution
%! p = 0.001:0.001:0.999;
%! data1 = 0 + 0.5 * randn (10000, 1);
%! data2 = 0 + 1.0 * randn (10000, 1);
%! data3 = 0 + 2.0 * randn (10000, 1);
%! pd1 = fitdist (data1, "Normal");
%! pd2 = fitdist (data2, "Normal");
%! pd3 = fitdist (data3, "Normal");
%! 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 ({"mu = 0, sigma = 0.5", "mu = 0, sigma = 1", "mu = 0, sigma = 2"}, ...
%!         "location", "northwest")
%! title ("Normal iCDF")
%! xlabel ("Probability")
%! ylabel ("values in x")
%!
%! ## This demonstrates the inverse CDF (quantiles) for Normal
%! ## distributions, useful for finding critical values in statistics,
%! ## such as z-scores for confidence levels.
