From 6:00 PM CST Friday, Feb 15th - 2:00 AM CST Sunday, Feb 17th, ni.com will be undergoing system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Filter Design (Smoothing) (G Dataflow)

Designs filter coefficients for a smoothing filter. You can use this node to design a moving-average FIR filter or an exponentially-averaging IIR filter.

Programming Patterns

To filter a sequence of data, wire the filter output to the Filtering node.

type

The type of smoothing filter to design.

Name Description
moving average

Yields forward-only (FIR) coefficients.

exponential

Yields first-order IIR coefficients.

Default: moving average

half-width

Half-width of the moving-average filter in samples. For a half-width of M, the full width of the moving-average filter is N = 1 + 2*M samples. Therefore, the full width N is always an odd number of samples.

Default: 1

shape

The shape of the moving-average filter.

Name Description
rectangular

Applies a rectangular moving-average filter to the samples. All samples in the moving-average window are weighted equally in computing each smoothed output sample.

triangular

Applies a triangular moving-average filter to the samples. The peak is centered in the middle of the moving-average window, ramping down symmetrically on both sides of the center sample.

Default: rectangular

time constant

Time constant of the exponential-weighting filter in seconds.

Default: 0.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

sampling frequency

Sampling frequency in samples per second.

Default: 0.01

filter

Output smoothing filter.

filter structure

Structure of the output filter.

forward coefficients

The forward coefficients of an IIR filter.

reverse coefficients

The reverse, or feedback, coefficients of an IIR filter.

sampling frequency

The sampling frequency in Hz.

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.

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported

Web Server: Not supported in VIs that run in a web application