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

 

本系列文章允许转载,转载请保留全文!

【说明&总目录】http://www.cnblogs.com/tbcaaa8/p/4415055.html

posted @ 2015-12-04 21:21  橴樰  阅读(9742)  评论(0编辑  收藏  举报