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 中查找有关 Particle & Nuclear Physics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!