MATLAB: 1D med filter

movmedianSignal Processing Toolbox

Can anyone please, help me with the 1D median filter algorithm?

Best Answer

M = movmedian(A,k) returns an array of local k-point median values, where each median is calculated over a sliding window of length k across neighboring elements of A. When k is odd, the window is centered about the element in the current position. When k is even, the window is centered about the current and previous elements. The window size is automatically truncated at the endpoints when there are not enough elements to fill the window. When the window is truncated, the median is taken over only the elements that fill the window. M is the same size as A.
I supposed you don't want to use that either? Well at least movmedian() is built into base MATLAB, unlike medfilt1() which is in the Signal Processing Toolbox.