Moving average

조회 수: 13 (최근 30일)
Shafi
Shafi 2011년 10월 26일
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

채택된 답변

bym
bym 2011년 10월 26일
x = mean(reshape(y,[],30)).' %y is 3000 x 1
  댓글 수: 3
Walter Roberson
Walter Roberson 2011년 10월 26일
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 2011년 10월 26일
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) ;)

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2011년 10월 26일
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
Shafi
Shafi 2011년 10월 26일
Many thanks. I got another solution from proecsm.

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

카테고리

Help CenterFile Exchange에서 Simulink에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by