sgolay

Savitsky-Golay filter coefficients.

Syntax

f=sgolay(p,n)

f=sgolay(p,n)

f=sgolay(p,n,m)

f=sgolay(p,n,m,ts)

Inputs

p
The polynomial order.
Type: integer
Dimension: scalar
n
The number of points in each polynomial fit.
Type: integer
Dimension: scalar
m
The derivative of the fitted polynomials to compute.
Type: integer
Dimension: scalar
ts
The sampling interval.
Type: double
Dimension: scalar

Outputs

f
The filter coefficients.
Dimension: matrix

Example

Compute coefficients for a fourth order filter fitted to groups of seven points for approximation of first derivatives, with unit time samples.

f = sgolay(4,7,1,1)
f = [Matrix] 7 x 7
-1.59452e+00   1.82504e+00   5.42569e-01  -8.63636e-01  -4.97114e-01   8.56782e-01  -2.69120e-01
-4.12698e-01  -9.92063e-02   2.69841e-01   3.33333e-01   6.34921e-02  -2.34127e-01   7.93651e-02
 5.69986e-02  -5.84055e-01  -1.80375e-02   4.39394e-01   2.75613e-01  -2.18975e-01   4.90620e-02
 8.73016e-02  -2.65873e-01  -2.30159e-01   2.74662e-16   2.30159e-01   2.65873e-01  -8.73016e-02
-4.90620e-02   2.18975e-01  -2.75613e-01  -4.39394e-01   1.80375e-02   5.84055e-01  -5.69986e-02
-7.93651e-02   2.34127e-01  -6.34921e-02  -3.33333e-01  -2.69841e-01   9.92063e-02   4.12698e-01
 2.69120e-01  -8.56782e-01   4.97114e-01   8.63636e-01  -5.42569e-01  -1.82504e+00   1.59452e+00