<< Normal Normal distfun_norminv >>

Distfun >> Distfun > Normal > distfun_normcdf

distfun_normcdf

Normal CDF

Calling Sequence

p=distfun_normcdf(x,mu,sigma)
p=distfun_normcdf(x,mu,sigma,lowertail)

Parameters

x :

a matrix of doubles, the outcome

mu :

a matrix of doubles, the mean

sigma :

a matrix of doubles, the standard deviation. sigma>0.

lowertail :

a 1-by-1 matrix of booleans, the tail (default lowertail=%t). If lowertail is true (the default), then considers P(X<=x) otherwise P(X>x).

p :

a matrix of doubles, the probability.

Description

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.

Examples

// 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\leq 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 )

Authors


Report an issue
<< Normal Normal distfun_norminv >>