MATLAB: 1D median filtering

signal processing

how to apply 1D median filter with 100ms window length?

Best Answer

Assuming your data are stored as a row vector D, and the sampling interval is T ms, and you have the Image Processing Toolbox, you could do this:
windowlength = 100;
windowsize = ceil(windowlength/T);
D_filtered = medfilt2(D, [1 windowsize]);
If the data are stored as a column vector, use
D_filtered = medfilt2(D, [windowsize 1]);
instead of the final line.
Related Question