필터 지우기
필터 지우기

20 periods moving average

조회 수: 2 (최근 30일)
Héctor Luna Enríquez
Héctor Luna Enríquez 2022년 8월 17일
답변: David Hill 2022년 8월 17일
I Have a (3000,100) Matrix containing the Returns of 3,000 companies for 100 periods, and i'd like to compute an average, for each company, for 20 periods. This is, first the average from period 1 to period 20, next the average from period 2 to period 21 and so on for each company.
I've tried with movemean, but i'm not sure i'm computing the values i'm interested in.
Thanks for the support

답변 (1개)

David Hill
David Hill 2022년 8월 17일
a=randi(100,3000,100);
A=movmean(a,20,2,'Endpoints','discard');

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by