Truncated Gaussian

版本 1.3.0.0 (3.5 KB) 作者: Bruno Luong
Generate a pseudo-random vector X drawn from the truncated Gaussian distribution
7.9K 次下载
更新时间 2010/8/12

查看许可证

% function X = TruncatedGaussian(sigma, range)
% X = TruncatedGaussian(sigma, range, n)

Generate a pseudo-random vector X of size n, X are drawn from the truncated Gaussian distribution in a RANGE braket; and satisfies std(X)=sigma.

RANGE is of the form [left,right] defining the braket where X belongs. For a scalar input RANGE, the braket is [-RANGE,RANGE].

If input SIGMA is negative, X will be forced to have the same "shape" of distribution function than the unbounded Gaussian with standard deviation -SIGMA: N(0,-SIGMA). It is similar to calling RANDN and throw away values ouside RANGE. In this case, the standard deviation of the truncated Gaussian will be different than -SIGMA. The *effective* mean and the effective standard deviation can be obtained by calling:

[X meaneffective sigmaeffective] = TruncatedGaussian(...)

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

引用格式

Bruno Luong (2024). Truncated Gaussian (https://www.mathworks.com/matlabcentral/fileexchange/23832-truncated-gaussian), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2009a
兼容任何版本
平台兼容性
Windows macOS Linux
致谢

启发作品: Truncated multivariate normal

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.3.0.0

Use asymptotic formula for unbalanced range to avoid round-off error issue

1.0.0.0