How can I make the following into a loop?

4 visualizaciones (últimos 30 días)
Pyro
Pyro el 26 de Feb. de 2015
Comentada: Star Strider el 26 de Feb. de 2015
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

Respuesta aceptada

Star Strider
Star Strider el 26 de Feb. de 2015
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 comentarios
Pyro
Pyro el 26 de Feb. de 2015
wow.. thanks for helping
Star Strider
Star Strider el 26 de Feb. de 2015
My pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by