Normal CDF
p = distfun_normcdf ( x ) p = distfun_normcdf ( x , mu , sigma ) p = distfun_normcdf ( x , mu , sigma , lowertail )
a 1x1 or nxm matrix of doubles, the outcome
a 1x1 or nxm matrix of doubles, the mean (default mu=0)
a 1x1 or nxm matrix of doubles, the standard deviation (default sigma=1)
a 1x1 matrix of booleans, the tail (default lowertail=%t). If lowertail is true (the default), then considers P(X<x) otherwise P(X>x).
a nxm matrix of doubles, the probability.
Computes the cumulated probability distribution function of the Normal (Laplace-Gauss) function.
Any scalar input argument is expanded to a matrix of doubles of the same size as the other input arguments.
The function definition is:
// Test default parameters computed = distfun_normcdf ( [-1 1] ) expected = [ 0.158655253931457 , .. 0.841344746068543 ] // Test expanded arguments computed = distfun_normcdf ( [1 2 3] , [1 1 1] , [2 2 2] ) expected = [ 0.500000000000000 , .. 0.691462461274013 , .. 0.841344746068543 ] // Test argument expansion computed = distfun_normcdf ( [1 2 3] , 1.0 , 2.0 ) expected = [ 0.500000000000000 , .. 0.691462461274013 , .. 0.841344746068543 ] // Plot the function mu = [0 0 0 -2]; sigma2 = [0.2 1.0 5.0 0.5]; cols = [1 2 3 4]; nf = size(cols,"*"); lgd = []; scf(); for k = 1 : nf x = linspace(-5,5,1000); y = distfun_normcdf ( x , mu(k) , sqrt(sigma2(k)) ); plot(x,y) str = msprintf("mu=%s, sigma^2=%s",.. string(mu(k)),string(sigma2(k))); lgd($+1) = str; end h = gcf(); for k = 1 : nf hk = h.children.children.children(nf - k + 1); hk.foreground = cols(k); end xtitle("Normal CDF","x","P(X<x)"); legend(lgd); // See upper tail p = distfun_normcdf ( 7, 4, 1 ) q = distfun_normcdf ( 7, 4, 1 , %f ) p+q // See an extreme case distfun_normcdf ( 15, 4, 1 , %f ) | ![]() | ![]() |