滑动平均函数(滤波器)matlab实现

滑动平均
filter

windowSize = 5;
b = (1/windowSize)*ones(1,windowSize);
a = 1;

y = filter(b,a,x);

y(1) is equivalent to 0.2*x(1).

y(2) is equivalent to 0.2*(x(1)+x(2)).

...

y(5) is equivalent to 0.2*(sum(x(1:5)) = mean(x(1:5)).

y(6) is equivalent to mean(x(2:6)).

...

y(100) is equivalent to mean(x(96:100)).

你可能感兴趣的:(滑动平均函数(滤波器)matlab实现)