フィルターのクリア

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 Center および File ExchangeResizing 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