Savitzky-Golay filter design

`b = sgolay(order,framelen)`

b = sgolay(order,framelen,weights)

[b,g] = sgolay(...)

`b = sgolay(order,framelen)`

designs
a Savitzky-Golay FIR smoothing filter with polynomial order `order`

and
frame length `framelen`

. `order`

must
be less than `framelen`

, and `framelen`

must
be odd. If `order`

= `framelen-1`

,
the designed filter produces no smoothing.

The output, `b`

, is a `framelen`

-by-`framelen`

matrix
whose rows represent the time-varying FIR filter coefficients. In
a smoothing filter implementation (for example, `sgolayfilt`

), the last `(framelen-1)/2`

rows
(each an FIR filter) are applied to the signal during the startup
transient, and the first `(framelen-1)/2`

rows are
applied to the signal during the terminal transient. The center row
is applied to the signal in the steady state.

`b = sgolay(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.

`[b,g] = sgolay(...)`

returns
the matrix `g`

of differentiation filters. Each column
of `g`

is a differentiation filter for derivatives
of order `p-1`

, where `p`

is the
column index. Given a signal `x`

of length `framelen`

,
you can find an estimate of the `p`

^{th} order
derivative, `xp`

, of its middle value from

xp((framelen+1)/2) = (factorial(p)) * g(:,p+1)' * x

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

`filter`

| `fir1`

| `firls`

| `sgolayfilt`

Was this topic helpful?