📄 movingaveragefilter.m
字号:
% 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -