Function Reference: hncdf

statistics: p = hncdf (x, mu, sigma)
statistics: p = hncdf (x, mu, sigma, "upper")

Half-normal cumulative distribution function (CDF).

For each element of x, compute the cumulative distribution function (CDF) of the half-normal distribution with location parameter mu and scale parameter sigma. The size of p 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.

[…] = hncdf (x, mu, sigma, "upper") computes the upper tail probability of the half-normal distribution with parameters mu and sigma, at the values in x.

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: hninv, hnpdf, hnrnd, hnfit, hnlike, hnstat

Source Code: hncdf

Example: 1

 

 ## Plot various CDFs from the half-normal distribution
 x = 0:0.001:10;
 p1 = hncdf (x, 0, 1);
 p2 = hncdf (x, 0, 2);
 p3 = hncdf (x, 0, 3);
 p4 = hncdf (x, 0, 5);
 plot (x, p1, "-b", x, p2, "-g", x, p3, "-r", x, p4, "-c")
 grid on
 xlim ([0, 10])
 legend ({"μ = 0, σ = 1", "μ = 0, σ = 2", ...
          "μ = 0, σ = 3", "μ = 0, σ = 5"}, "location", "southeast")
 title ("Half-normal CDF")
 xlabel ("values in x")
 ylabel ("probability")

                    
plotted figure

Example: 2

 

 ## Plot half-normal against normal cumulative distribution function
 x = -5:0.001:5;
 p1 = hncdf (x, 0, 1);
 p2 = normcdf (x);
 plot (x, p1, "-b", x, p2, "-g")
 grid on
 xlim ([-5, 5])
 legend ({"half-normal with μ = 0, σ = 1", ...
          "standart normal (μ = 0, σ = 1)"}, "location", "southeast")
 title ("Half-normal against standard normal CDF")
 xlabel ("values in x")
 ylabel ("probability")

                    
plotted figure