📄 medianfilter.m
字号:
function y=medianfilter(x,n)
% The function MEDIANFILTER returns data smoothed by n-point median filter.
%
% Calling sequence-
% y=medianfilter(x,n)
%
% Input-
% x - column vector of input data x(n)
% n - number of smoothing points
% Output-
% y - column vector of filtered data y(n)
%
%----- Define the smoothing range indexes
lbound = floor(n/2);
rbound = n-lbound-1;
y=x;
%----- Run the filter
for i=lbound+1:length(x)-rbound-1
y(i)=median(x(i-lbound:i+rbound));
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -