### Function Reference: `hnpdf`

statistics: y = hnpdf (x, mu, sigma)

Half-normal probability density function (PDF).

For each element of x, compute the probability density function (PDF) of the half-normal distribution with location parameter mu and scale parameter sigma. The size of y is the common size of x, mu, and sigma. A scalar input functions as a constant matrix of the same size as the other inputs.

The half-normal CDF is only defined for `x >= mu`.

Further information about the half-normal distribution can be found at https://en.wikipedia.org/wiki/Half-normal_distribution

See also: hncdf, hninv, hnrnd, hnfit, hnlike, hnstat

Source Code: hnpdf

### Example: 1

     ## Plot various PDFs from the half-normal distribution
     x = 0:0.001:10;
     y1 = hnpdf (x, 0, 1);
     y2 = hnpdf (x, 0, 2);
     y3 = hnpdf (x, 0, 3);
     y4 = hnpdf (x, 0, 5);
     plot (x, y1, "-b", x, y2, "-g", x, y3, "-r", x, y4, "-c")
     grid on
     xlim ([0, 10])
     ylim ([0, 0.9])
     legend ({"μ = 0, σ = 1", "μ = 0, σ = 2", ...
              "μ = 0, σ = 3", "μ = 0, σ = 5"}, "location", "northeast")
     title ("Half-normal PDF")
     xlabel ("values in x")
     ylabel ("density")

### Example: 2

     ## Plot half-normal against normal probability density function
     x = -5:0.001:5;
     y1 = hnpdf (x, 0, 1);
     y2 = normpdf (x);
     plot (x, y1, "-b", x, y2, "-g")
     grid on
     xlim ([-5, 5])
     ylim ([0, 0.9])
     legend ({"half-normal with μ = 0, σ = 1", ...
              "standart normal (μ = 0, σ = 1)"}, "location", "northeast")
     title ("Half-normal against standard normal PDF")
     xlabel ("values in x")
     ylabel ("density")