We discuss two filters that are frequently used to smooth data.
One is the (nonlinear) median filter, that chooses the median
of the sample values in the sliding window. This deals effectively
with "outliers" that are beyond the correct sample range, and will
never be chosen as the median. A straightforward implementation of
the filter is expensive for large windows, particularly in two dimensions
(for images).
\\
\\
The second filter is linear, and known as "Savitzky-Golay". It is
frequently used in spectroscopy, to locate positions and peaks and
widths of spectral lines. This filter is based on a least-squares fit
of the samples in the sliding window to a polynomial of relatively
low degree. The filter coefficients are unlike the equiripple filter
that is optimal in the maximum norm, and the "maxflat" filters that
are central in wavelet constructions. Should they be better known....?
\\
\\
We will discuss the analysis and the implementation of both filters.