<< distfun_tnormrnd Truncated Normal Uniform Discrete >>

Distfun >> Distfun > Truncated Normal > distfun_tnormstat

distfun_tnormstat

Truncated Normal mean and variance

Calling Sequence

M=distfun_tnormstat(mu,sigma,a,b)
[M,V]=distfun_tnormstat(mu,sigma,a,b)

Parameters

mu :

a matrix of doubles, the average

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)

M :

a matrix of doubles, the mean

V :

a matrix of doubles, the variance

Description

Computes statistics from the Normal distribution.

The mean and variance of the Normal distribution are

Any scalar input argument is expanded to a matrix of doubles of the same size as the other input arguments.

Examples

mu = 1:6;
sigma = 7:12;
a=-10;
b=10;
[M,V]=distfun_tnormstat(mu,sigma,a,b)

// Compare with random numbers
a=-10;
b=10;
N=1000;
//
mu=-8;
sigma=2;
[M,V]=distfun_tnormstat(mu,sigma,a,b);
x=distfun_tnormrnd(mu,sigma,a,b,N,1);
[M,mean(x)]
[V,variance(x)]
//
mu=0;
sigma=2;
[M,V]=distfun_tnormstat(mu,sigma,a,b);
x=distfun_tnormrnd(mu,sigma,a,b,N,1);
[M,mean(x)]
[V,variance(x)]
//
mu=9;
sigma=10;
[M,V]=distfun_tnormstat(mu,sigma,a,b);
x=distfun_tnormrnd(mu,sigma,a,b,N,1);
[M,mean(x)]
[V,variance(x)]
//
mu=0;
sigma=10;
[M,V]=distfun_tnormstat(mu,sigma,a,b);
x=distfun_tnormrnd(mu,sigma,a,b,N,1);
[M,mean(x)]
[V,variance(x)]

Authors

Bibliography

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


Report an issue
<< distfun_tnormrnd Truncated Normal Uniform Discrete >>