<< Truncated Normal Truncated Normal distfun_tnorminv >>

Distfun >> Distfun > Truncated Normal > distfun_tnormcdf

distfun_tnormcdf

Truncated Normal CDF

Calling Sequence

p=distfun_tnormcdf(x,mu,sigma,a,b)
p=distfun_tnormcdf(x,mu,sigma,a,b,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.

a :

a matrix of doubles, the lower bound

b :

a matrix of doubles, the upper bound (with a<=b)

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
p=distfun_tnormcdf([-2 1.5 3],[1 1 1],[2 2 2],0,2)
expected = [0. 0.7577694 1.]

// Test argument expansion
computed=distfun_tnormcdf([-3 -1 1 2 3],1.,2.,-1,2)
expected=[0. 0. 0.6406534 1. 1.]

// Plot the function
a=-10;
b=10;
x=linspace(a,b,1000);
p1=distfun_tnormcdf(x,-8,2,a,b);
p2=distfun_tnormcdf(x,0,2,a,b);
p3=distfun_tnormcdf(x,9,10,a,b);
p4=distfun_tnormcdf(x,0,10,a,b);
scf();
plot(x,p1,"k-")
plot(x,p2,"b-")
plot(x,p3,"r-")
plot(x,p4,"g-")
xtitle("Truncated normal [-10,10]","X","CDF");
legend(["$\mu=-8,\sigma=2$","$\mu=0,\sigma=2$",..
"$\mu=9,\sigma=10$","$\mu=0,\sigma=10$"]);

Authors

Bibliography

http://en.wikipedia.org/wiki/Truncated_normal_distribution


Report an issue
<< Truncated Normal Truncated Normal distfun_tnorminv >>