User`s guide

Smoothing Data
2-19
Savitzky-Golay Filtering
Savitzky-Golay filtering can be thought of as a generalized moving average.
You derive the filter coefficients by performing an unweighted linear least
squares fit using a polynomial of a given degree. For this reason, a
Savitzky-Golay filter is also called a digital smoothing polynomial filter or a
least squares smoothing filter. Note that a higher degree polynomial makes it
possible to achieve a high level of smoothing without attenuation of data
features.
The Savitzky-Golay filtering method is often used with frequency data or with
spectroscopic (peak) data. For frequency data, the method is effective at
preserving the high-frequency components of the signal. For spectroscopic
data, the method is effective at preserving higher moments of the peak such as
the line width. By comparison, the moving average filter tends to filter out a
significant portion of the signals high-frequency content, and it can only
preserve the lower moments of a peak such as the centroid. However,
Savitzky-Golay filtering can be less successful than a moving average filter at
rejecting noise.
The Savitzky-Golay smoothing method used by the Curve Fitting Toolbox
follows these rules:
The span must be odd.
The polynomial degree must be less than the span.
The data points are not required to have uniform spacing.
Normally, Savitzky-Golay filtering requires uniform spacing of the predictor
data. However, the algorithm provided by the Curve Fitting Toolbox
supports nonuniform spacing. Therefore, you are not required to perform an
additional filtering step to create data with uniform spacing.
The plot shown below displays generated Gaussian data and several attempts
at smoothing using the Savitzky-Golay method. The data is very noisy and the
peak widths vary from broad to narrow. The span is equal to 5% of the number
of data points.