Note: This page has been translated by MathWorks. Please click here

To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materials including this page, select Japan from the country navigator on the bottom of this page.

Savitzky-Golay filtering

`y = sgolayfilt(x,order,framelen)`

y = sgolayfilt(x,order,framelen,weights)

y = sgolayfilt(x,order,framelen,weights,dim)

`y = sgolayfilt(x,order,framelen)`

applies
a Savitzky-Golay FIR smoothing filter to the data in vector `x`

.
If `x`

is a matrix, `sgolayfilt`

operates
on each column. The polynomial order, `order`

, must
be less than the frame length, `framelen`

, and in
turn `framelen`

must be odd. If `order`

= `framelen-1`

, the
filter produces no smoothing.

`y = sgolayfilt(x,order,framelen,weights)`

specifies
a weighting vector, `weights`

, with length `framelen`

,
which contains the real, positive-valued weights to be used during
the least-squares minimization. If `weights`

is not
specified, or if it is specified as empty, `[]`

,
it defaults to an identity matrix.

`y = sgolayfilt(x,order,framelen,weights,dim)`

specifies
the dimension, `dim`

, along which the filter operates.
If `dim`

is not specified, `sgolayfilt`

operates
along the first nonsingleton dimension; that is, dimension 1 for column
vectors and nontrivial matrices, and dimension 2 for row vectors.

Savitzky-Golay smoothing filters (also called digital smoothing polynomial filters or least-squares smoothing filters) are typically used to “smooth out” a noisy signal whose frequency span (without noise) is large. In this type of application, Savitzky-Golay smoothing filters perform much better than standard averaging FIR filters, which tend to filter out a significant portion of the signal's high frequency content along with the noise. Although Savitzky-Golay filters are more effective at preserving the pertinent high frequency components of the signal, they are less successful than standard averaging FIR filters at rejecting noise.

Savitzky-Golay filters are optimal in the sense that they minimize the least-squares error in fitting a polynomial to frames of noisy data.

[1] Orfanidis, Sophocles J. *Introduction
to Signal Processing*. Englewood Cliffs, NJ: Prentice-Hall,
1996.

Was this topic helpful?