Moving average

15 visualizaciones (últimos 30 días)
Shafi
Shafi el 26 de Oct. de 2011
Greetings,
I have a 3000x1 matrix and I want make it 30x1 matrix by taking average from each 100 values. Is there any simple command or way to do that.
Your help is highly appreciated.
Thanks and regards Shafi

Respuesta aceptada

bym
bym el 26 de Oct. de 2011
x = mean(reshape(y,[],30)).' %y is 3000 x 1
  3 comentarios
Walter Roberson
Walter Roberson el 26 de Oct. de 2011
Hmmmm... you are right, Shafi might have meant that. I would probably refer to that as a "block average", though, whereas the title said "moving average".
bym
bym el 26 de Oct. de 2011
yes, I have been confused at times with questions. I try to start at the simplest answer first. That way, I can exclude myself fairly quickly when the question grow beyond my means (which is most of the time) ;)

Iniciar sesión para comentar.

Más respuestas (1)

Walter Roberson
Walter Roberson el 26 de Oct. de 2011
I believe people have suggested something like
conv(x,ones(30,1))
I haven't tried that myself. (I am not from a signals processing background, so I tend to instead code it in terms of cumsum() )
  1 comentario
Shafi
Shafi el 26 de Oct. de 2011
Many thanks. I got another solution from proecsm.

Iniciar sesión para comentar.

Categorías

Más información sobre Simulink en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by