randn function does not work
古いコメントを表示
the average value of data generated by function 'randn' is not zero
1 件のコメント
採用された回答
その他の回答 (2 件)
Guillaume
2017 年 11 月 27 日
For some reason, my dice don't work either. I've thrown them many times, yet the mean value is not exactly 3.5.
>> mean(randn(1, 1e8))
ans =
-1.9019e-04
Pretty close to zero if you ask me. You'll only get exactly zero if you call randn an infinite number of times (or you're really lucky)
Binbin Zhang
2017 年 11 月 27 日
0 投票
1 件のコメント
David Goodmanson
2017 年 11 月 27 日
Somebody should mention that if you take N samples from a distribution with standard deviation 1, then the standard deviation of the N-sample mean is 1/sqrt(N). So in Guillaume's example with N = 1e8, you would expect an answer down around 1e-4, which is what happened.
カテゴリ
ヘルプ センター および File Exchange で 均匀分布(连续) についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!