Generate a random data with fix mean
2 ビュー (過去 30 日間)
古いコメントを表示
I have a matrix with 360 elements and I need to expand it to 3600 elements with the same mean and standard deviation.
0 件のコメント
採用された回答
Wayne King
2014 年 1 月 7 日
編集済み: Wayne King
2014 年 1 月 7 日
You don't say the size of your matrix, you just tell us the number of elements. You also do not give us any information about the distribution -- is it Gaussian?
Xstart = randn(360,1);
meanX = mean(Xstart);
stdX = std(Xstart);
Xend = [Xstart ; stdX*randn(3600-360,1)+meanX];
2 件のコメント
Image Analyst
2014 年 1 月 7 日
Of course repmat() also meets the requirements (or lack thereof).
vector3600 = repmat(vector360, [1, 10]);
その他の回答 (2 件)
参考
カテゴリ
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!