%!demo
%! ## Plot various iCDFs from the Rayleigh distribution
%! p = 0.001:0.001:0.999;
%! data1 = raylrnd (0.5, 10000, 1);
%! data2 = raylrnd (1.0, 10000, 1);
%! data3 = raylrnd (2.0, 10000, 1);
%! pd1 = fitdist (data1, "Rayleigh");
%! pd2 = fitdist (data2, "Rayleigh");
%! pd3 = fitdist (data3, "Rayleigh");
%! 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 ({"sigma = 0.5", "sigma = 1", "sigma = 2"}, ...
%!         "location", "northwest")
%! title ("Rayleigh iCDF")
%! xlabel ("Probability")
%! ylabel ("values in x (x >= 0)")
%!
%! ## This demonstrates the inverse CDF (quantiles) for Rayleigh
%! ## distributions, useful for finding values corresponding to given
%! ## probabilities, such as thresholds in radar detection.
