movingaveragefilter.m
来自「Continuous Profile Models (CPM) Matlab T」· M 代码 · 共 33 行
M
33 行
% function c = movingAverageFilter(x,span)%% span is the number of points to be averaged at each timefunction smoothX = movingAverageFilter(x,span)if (length(size(x))>2) error('only works on vectors');elseif (min(size(x))~=1) error('only works on vectors');endN=length(x);if span==1 smoothX=x; return;endif span==N smoothX=mean(x)*ones(size(x));end%% normalized filter with equal weight everywherefilt = ones(1,span)/span;%% use 2D conv because it has the 'same' optionsmoothX = conv2(filt,1,x','same');return;% figure,subplot(2,1,1),plot(smoothX); subplot(2,1,2),plot(x);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?