# Savitzky-Golay Filter Design (G Dataflow)

Designs a Savitzky-Golay FIR smoothing filter, returning the designed Savitzky-Golay filter coefficients and the differentiation filter coefficients.

## compute differentiation filters?

A Boolean that determines whether the node calculates the differentiation filters.

 True The node calculates the differentiation filters. False The node does not calculate the differentiation filters.

Default: True

## side points

The number of data points to each side of the current data point to use for the least-squares minimization.

side points*2 + 1 is the length of the moving window, which must be greater than the polynomial order.

Default: 6

## polynomial order

Order of the polynomial.

Default: 3

## weight

Weighting vector to use in the least squares minimization.

This array must be empty or have a length of side points*2 + 1.

## error in

Error conditions that occur before this node runs.

The node responds to this input according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Default: No error

## Savitzky-Golay filters

A matrix with rows representing the FIR filter coefficients.

The matrix is n-by-n, where n is side points*2+1.

## differentiation filters

A matrix where the p-th row is the differentiation filter for the p-th order derivative.

The matrix is m-by-n, where m is polynomial order+1, and n is side points*2+1.

This node computes differentiation filters only if compute differentiation filters? is True.

## error out

Error information.

The node produces this output according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

## Applying a Savitzky-Golay Filter

The Savitzky-Golay filter smoothes a noisy signal by the piece-by-piece fitting of a polynomial function to the signal. This node performs the fitting by least squares minimization. The length of the moving polynomial fitting window is 2k+1, where k is side points.

The central row of Savitzky-Golay filters estimates the middle point of the moving window. The other rows of Savitzky-Golay filters smooth the endpoints of the signal, where the window length exceeds the number of remaining data points.

To smooth a signal, apply the first k rows of Savitzky-Golay filters to the first 2k+1 points of the signal to get the first k smoothed points. Apply the last k rows of Savitzky-Golay filters to the last 2k+1 points of the signal to get the last k smoothed points. Apply the central row of Savitzky-Golay filters for all other points.

Where This Node Can Run:

Desktop OS: Windows

FPGA: This product does not support FPGA devices