20 periods moving average
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
0 comentarios
Respuestas (1)
David Hill
el 17 de Ag. de 2022
a=randi(100,3000,100);
A=movmean(a,20,2,'Endpoints','discard');
0 comentarios
Ver también
Categorías
Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!