필터 지우기
필터 지우기

Generate a random data with fix mean

조회 수: 2 (최근 30일)
Ahmed Hussein
Ahmed Hussein 2014년 1월 7일
댓글: Image Analyst 2014년 1월 7일
I have a matrix with 360 elements and I need to expand it to 3600 elements with the same mean and standard deviation.

채택된 답변

Wayne King
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
Ahmed Hussein
Ahmed Hussein 2014년 1월 7일
Thank you very much
Image Analyst
Image Analyst 2014년 1월 7일
Of course repmat() also meets the requirements (or lack thereof).
vector3600 = repmat(vector360, [1, 10]);

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Ahmed Hussein
Ahmed Hussein 2014년 1월 7일
The matrix is [1,360] and the distribution is Gaussian
Thank you very much

Ahmed Hussein
Ahmed Hussein 2014년 1월 7일
Thank you very much

카테고리

Help CenterFile Exchange에서 Particle & Nuclear Physics에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by