how to generate random variables with gaussian distribution with 0 mean and 1 standard deviation.
조회 수: 12 (최근 30일)
이전 댓글 표시
rand is for uniform standard distribution i think...then what about gaussian distribution.what command is available
답변 (2개)
David Sanchez
2013년 11월 28일
r = rand(n) returns an n-by-n matrix containing pseudorandom values drawn from the standard uniform distribution on the open interval (0,1). The mean determines the location of the distribution while the std. deviation determines the width of the bell curve. By all that,
mean+ standard deviation*randn()
will yield a distribution with your mean and your standard deviation.
댓글 수: 0
Andrei Bobrov
2013년 11월 28일
편집: Andrei Bobrov
2013년 11월 28일
Example:
x = randn(200);
x1 = x(:) - mean(x(:));
out = reshape(x1/std(x1),size(x));
[mean(out(:)),std(out(:))]
It's for mean1 = 0 and std1 = 1 ;
For
mean1 = 2;
std1 = 3;
x = randn(200);
x1 = x(:) - mean(x(:));
s = x1/std(x1)*std1;
out = reshape(s + mean1,size(x));
[mean(out(:)),std(out(:))]
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Multivariate Normal Distribution에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!