sgolayfilt

Syntax

Description

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 k = 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.

The sgolayfilt function performs most of the filtering by convolving the signal with the center row of B, the output of sgolay. The result is the steady-state portion of the filtered signal. Generate and plot this portion.

More About

Tips

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.