: y = medfilt1 (x, n)
: y = medfilt1 (x, n, [], dim)
: y = medfilt1 (..., NaN_flag, padding)

Apply a one dimensional median filter with a window size of n to the data x, which must be real, double and full. For n = 2m+1, y(i) is the median of x(i-m:i+m). For n = 2m, y(i) is the median of x(i-m:i+m-1).

The calculation is performed over the first non-singleton dimension, or over dimension dim if that is specified as the fourth argument. (The third argument is ignored; Matlab used to use it to tune its algorithm.)

NaN_flag may be omitnan or includenan (the default). If it is omitnan then any NaN values are removed from the window before the median is taken. Otherwise, any window containing an NaN returns a median of NaN.

padding determines how the partial windows at the start and end of x are treated. It may be truncate or zeropad (the default). If it is truncate then the window for y(i) is the intersection of the window stated above with 1:length(x). If it is zeropad, then partial windows have additional zeros to bring them up to size n.

See also: filter, medfilt2.

Package: signal