MATLAB 利用filter函数实现滑动平均滤波
function [ y ] = moving_average( x, win_size ) y1=filter(ones(1,win_size/2+1)/win_size,1,x); y2=filter(ones(1,win_size/2+1)/win_size,1,fliplr(x)); y=y1+fliplr(y2)-(1/win_size)*x; end
L = win_size/2;
yi = (1/win_size)∑(j=i-L:i+L)xj
本系列文章允许转载,转载请保留全文!