<< distfun_tnorminv Truncated Normal distfun_tnormrnd >>

Distfun >> Distfun > Truncated Normal > distfun_tnormpdf

distfun_tnormpdf

Truncated Normal PDF

Calling Sequence

y=distfun_tnormpdf(x,mu,sigma,a,b)

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)

y :

a matrix of doubles, the density

Description

Computes the 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:

if x is in the [a,b] interval and zero otherwise, where

and is the standard normal cumulated distribution function (i.e. CDF), and is the standard normal probability distribution function (i.e. PDF).

Examples

y=distfun_tnormpdf([-2 -1 0 1],0,1,-1,1)
expected = [ 0.241970724519143   0.241970724519143 ];

// Plot the function
a=-10;
b=10;
x=linspace(a,b,1000);
y1=distfun_tnormpdf(x,-8,2,a,b);
y2=distfun_tnormpdf(x,0,2,a,b);
y3=distfun_tnormpdf(x,9,10,a,b);
y4=distfun_tnormpdf(x,0,10,a,b);
scf();
plot(x,y1,"k-")
plot(x,y2,"b-")
plot(x,y3,"r-")
plot(x,y4,"g-")
xtitle("Truncated normal [-10,10]","X","PDF");
legend(["$\mu=-8,\sigma=2$","$\mu=0,\sigma=2$",..
"$\mu=9,\sigma=10$","$\mu=0,\sigma=10$"]);

Bibliography

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

Authors


Report an issue
<< distfun_tnorminv Truncated Normal distfun_tnormrnd >>