SGOLAY

Purpose:

Generates Savitzky-Golay smoothing filter coefficients.

Syntax:

SGOLAY(d, N, w)

(B, G) = SGOLAY(d, N, w)

d

-

Optional. An integer, the Savitzky-Golay polynomial degree. Defaults to 3, a 3rd order Savitzky-Golay filter.

N

-

Optional. An integer, the number of points for the smoothing window. Defaults to d + 2 if d is odd, else d + 3.

w

-

Optional. A series of length N, the weighting factors. Defaults to all ones.

Returns:

An NxN array, the Savitzky-Golay smoothing filter coefficients.

 

(B, G) = sgolay(d, N, w) returns the smoothing filter coefficients and derivative coefficients as two separate arrays.

Example:

W1: sgolay()

W2: sgolay(4, 9)

 

W1 contains a 5x5 array of 3rd order Savitzky-Golay smoothing filter coefficients. W2 contains a 9x9 array of 4th order Savitzky-Golay smoothing coefficients.

Example:

(b, g) = sgolay(4, 9)

 

Variable b contains a 9x9 array of 4th order Savitzky-Golay smoothing filter coefficients and g contains a 9x5 array of Savitzky-Golay derivative coefficients.

Example:

W1: gsweep(1000, 1/1000, 1, 50) + gnorm(1000, 1/1000)/5

W2: sgolay(3, 21)

W3: sgolayfilt(w1, w2)

 

W2 contains a 3rd order, 21 point Savitzky-Golay smoothing filter. W3 process the data in W1 with the filter.

Remarks:

Savitzky-Golay filters perform data smoothing and preserve peak resolution by least squares fitting a d order polynomial to an N point sliding window. The data window, N, should be an odd value.

 

See SGOLAYFILT to compute the Savitzky-Golay coefficients and filter input data in one step.

See Also:

CONV

FILTEQ

LINAVG

MOVAVG

SGOLAYFILT