Pulmochart Reference (ver. 5.5)
Savitzky-Golay filter

Savitzky-Golay filter

Overview

The Savitzky-Golay filter, see [Savitzky1964] and [Orfanidis1996] is also called polynomial smoothing or least-squares smoothing filter. In comparison to an averager, the Savitzky-Golay filter preserves higher frequencies in the signal better. But therefore it does not remove as much noise as an averager.

Details

The Savitzky-Golay filter employs several parameters, that need to be adapted.

Moving window length
The length of the moving window has to be provided in seconds. Internally the window length is converted into a number of samples.
Since the moving window size in samples has to be a positive and odd number, the window length in seconds is automatically adapted.
The moving window size in seconds (minimal window size is the duration of one sample interval).
The size of the window has an effect on the smoothness. The larger the window, the more samples are part of the equation, and the stronger the smoothing effect will be.

Polynomial degree
The polynomial degree is used for the linear least-squares fitting. Must be at least 1, and at least one less than the window size in samples, and at least one more than the derivative.

For example, for a signal with a sample frequency of 200Hz and a distance of 0.005 s between two samples:
derivative = 1, polynomial degree = 2 => moving window >= 3 * 0.005s

In general one can say that the higher the polynomial degree is chosen, the better the filter can predict higher frequency noise, and the less smooth the result will be. Note, to get the Nth derivative, the polynomial degree should be at least N+1.
A polynomial degree of 1 will result in smoothing equal to what the Averager operator ("Averager") does.

Derivative
The derivative is used as a differentiation filter vector. The derivative order depends on the moving window length and the polynomial degree, see above.