Normally distributed pseudorandom numbers using randn

Why doesn't
EDU>> r = 10.5 + 1.*randn(1,10);
EDU>> mean(r)
ans =
10.5848
return a mean of 10.5 if I specified that this set of pseudorandom numbers should have a mean of 10.5 in the command line?

 채택된 답변

Wayne King
Wayne King 2013년 9월 27일
편집: Wayne King 2013년 9월 27일
You cannot expect it to have exactly a mean of 10.5 in one realization of the random vector. If you repeat that experiment a large number of times, you will see the mean of the means will come very close to 10.5
for nn = 1:1e4
x = 10.5+randn(1,10);
meanz(nn) = mean(x);
end
mean(meanz)
Just taking a sample from a N(mu,sigma^2) population does not guarantee the mean of the sample will be mu. You have to look at the sampling distribution of the sample mean.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Random Number Generation에 대해 자세히 알아보기

태그

질문:

2013년 9월 27일

댓글:

2013년 9월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by