Efficiently calculate exponentially weighted moving averages of matrix?

9 visualizaciones (últimos 30 días)
yari lazzaro
yari lazzaro el 4 de Dic. de 2018
Editada: Bill Tubbs el 22 de Jul. de 2021
Hi, I've seen movmean function to calculate the moving average, but is there any function to compute the exponentially weighted moving average of a matrix of values? I would like to compute it considering a window moving over rows.
Thank you for your help.

Respuestas (1)

Bill Tubbs
Bill Tubbs el 22 de Jul. de 2021
Editada: Bill Tubbs el 22 de Jul. de 2021
I find the easiest way is to use a discrete filter. But the input data is in columns here not rows:
x = [0 1 1 1 1; 0 0 1 1 1]'; % input signals in columns
a = 0.4; % smoothing factor (0 to 1);
% y(k) = a / (1 - (1-a)*q^-1) * x(k)
y = filter(a,[1 a-1], x)
y =
0 0
0.4000 0
0.6400 0.4000
0.7840 0.6400
0.8704 0.7840

Categorías

Más información sobre Matched Filter and Ambiguity Function en Help Center y File Exchange.

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by