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!