matlab random number generation, normrnd VS mvnrnd
3 ビュー (過去 30 日間)
古いコメントを表示
Suppose I need to generate 5 iid RV's with mean 0 and stdev 0.5. I am aware of the distinction between normrnd and mvnrnd because the former is for a single random variable while mvnrnd is for multiple random variables.
I am however wondering if both normrnd(0,0.5,[1 5]) and mvnrnd(zeros(1,5),0.5^2*eye(5)) will suit the above objective.
I was told before that if the random number generator is good then the random variates obtained from normrnd(0,0.5,[1 5]) ought to be independent. Is this true or would mvnrnd(zeros(1,5),0.5^2*eye(5)) be the safer bet or would either way accomplish my objective?
0 件のコメント
採用された回答
the cyclist
2014 年 8 月 25 日
These will both accomplish the same thing. mvnrnd() is more for creating correlated random variables (with uncorrelated as a special case, as you are using it).
normrnd() will definitely create iid distributions (with the general constraints of pseudorandom generation). Also, it has the merit of being significantly faster.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Random Number Generation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!