Truncated Normal mean and variance
M=distfun_tnormstat(mu,sigma,a,b) [M,V]=distfun_tnormstat(mu,sigma,a,b)
a matrix of doubles, the average
a matrix of doubles, the standard deviation. sigma>0.
a matrix of doubles, the lower bound
a matrix of doubles, the upper bound (with a<=b)
a matrix of doubles, the mean
a matrix of doubles, the variance
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.
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)] | ![]() | ![]() |
http://en.wikipedia.org/wiki/Truncated_normal_distribution