%!demo
%! ## Plot the PDF of an Extreme Value distribution, with parameters mu = 0
%! ## and sigma = 1, truncated at [-2, 2] intervals. Generate 10000 random
%! ## samples from this truncated distribution and superimpose a histogram scaled
%! ## accordingly
%!
%! pd = makedist ("ExtremeValue", "mu", 0, "sigma", 1)
%! t = truncate (pd, 0.5, 4)
%! rand ("seed", 21);
%! data = random (t, 10000, 1);
%!
%! ## Plot histogram and fitted PDF
%! plot (t)
%! hold on
%! hist (data, 100, 50)
%! hold off
%! title ("Extreme Value distribution (mu = 0, sigma = 1) truncated at [0.5, 4]")
%! legend ("Truncated PDF", "Histogram")
%!
%! ## This demonstrates truncating an Extreme Value distribution to a specific
%! ## range and visualizing the resulting distribution with random samples.
