How can I make the following into a loop?

조회 수: 1 (최근 30일)
Pyro
Pyro 2015년 2월 26일
댓글: Star Strider 2015년 2월 26일
X= [some matrix I already stored and I want to add guassian noise to it, and average them out]
X_23= X + randn(size(X));
X_24= X + randn(size(X));
X_25= X + randn(size(X));
X_26= X + randn(size(X));
X_27= X + randn(size(X));
X_28= X + randn(size(X));
X_29= X + randn(size(X));
X_30= X + randn(size(X));
.
.
.
and so on

채택된 답변

Star Strider
Star Strider 2015년 2월 26일
In a word, DON’T!
Do this instead:
N = 42; % Choose A Number
for k1 = 1:N
Xn(k1,:,:) = X + randn(size(X));
end
It will then be much easier to do operations on your ‘Xn’ (‘X noise’) matrix.
  댓글 수: 2
Pyro
Pyro 2015년 2월 26일
wow.. thanks for helping
Star Strider
Star Strider 2015년 2월 26일
My pleasure!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by