3. Sohil Zidan
Savitzky-Golay Filter
● A moving polynomial fit can be numerically handled in exactly the same way as a
weighted moving average filter
● reduce high frequency noise in a signal due to its smoothing properties and reduce low
frequency signal (e.g., due to offsets and slopes) using differentiation
Introduction
Signal Filtering 3
4. Sohil Zidan
Savitzky-Golay Filter
● A moving polynomial fit can be numerically handled in exactly the same way as a
weighted moving average filter
● reduce high frequency noise in a signal due to its smoothing properties and reduce low
frequency signal (e.g., due to offsets and slopes) using differentiation
● Applicable to:
○ Equally spaced data values
○ Sampling space
○
○ The non-causal filter replaces each data value fi by a linear combination gi of itself
and some number of nearby neighbors,
○ : number of left points to the data point i (earlier)
○ : number of right points (later)
Introduction
Signal Filtering 4
5. Sohil Zidan
Savitzky-Golay Filter
● As a starting point consider a moving average window with cn=1/(nL+nR)
● The idea behind SGF is to approximate the underlying function with the moving window
not by a constant, but by a polynomial or higher order, typically quadratic or quartic
● For each point fi we least-squares fit a polynomial to all nL+nR+1 in the moving window
and then get gi to be the value of that polynomial at position i.
● When we move on to the next point fi+1, we do a whole new least-squares fit using a
shifted window… laborious job !
Introduction
Signal Filtering 5
6. Sohil Zidan
Savitzky-Golay Filter
● The goal is to fit a polynomial of degree M in z:
z=-nL, …,nR: n point equally spaced
● To the values
● g0 will be the value of the that polynomial at z=0, namely a0
● : is a Vandermonde Matrix,
z=-nL, …,nR: n point equally spaced
j=0, …,M
Polynomial Fitting 1/2
Signal Filtering 6
7. Sohil Zidan
Savitzky-Golay Filter
● Goal: fit the polynomial …. Eq(1)
● The normal equations for the vector of in terms of the vector of is in matrix
notation:
● Or
… Eq(2)
● For :
○ a certain window size m
○ and polynomial degree A is known
then we can compute coefficients of f which are known as convolution coefficients C
● No we get the and from the Eq(1) with the center point z = 0
Polynomial Fitting 2/2
Signal Filtering 7
8. Sohil Zidan
Savitzky-Golay Filter
● We get
● Savitzky and Goaly computed some configuration and put it into a table
● For
○ window size= 5
○ cubic polynomial degree M = 3 we get the following
smoothed value
Generating Configurations
Signal Filtering 8
9. Sohil Zidan
Savitzky-Golay Filter
● Values other than the center ?
● All can be computed using Eq(2)
● Then using Eq(1) we can create a smoothed value of any point of the equally-spaced
points set
● The red line:
○ the local polynomial being used to
fit a subset of the data.
● The smoothed values are shown as circles.
Conclusion
Signal Filtering 9