# Filter Design (Parks-McClellan) (G Dataflow)

Version:

Designs a linear-phase FIR multiband filter using the Parks-McClellan algorithm.

##### Programming Patterns

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

## filter type

The type of filter that you want to use.

Name Description
Multiband

Uses a multiband filter. If number of taps is an odd number, this node does not place restrictions on the value of the Amplitude. If number of taps is an even number, the Amplitude of the last band at half of sampling frequency must be 0.

Differentiator

Uses a differentiator. If number of taps is an even number, this node does not place restrictions on the last band. If number of taps is an odd number, the value of Higher Freq in the last band must be less than half of sampling frequency. For example, a typical normalized band {0, 0.49} leaves a 0.01 transitional band at half of the sampling frequency, 0.5.

Hilbert

Uses a Hilbert transformer. The value of Lower Freq in the first band must be greater than 0. A typical normalized Lower Freq in the first band is 0.03. If number of taps is an even number, this node does not place restrictions on the last band. If number of taps is an odd number, the value of Higher Freq in the last band must be less than half of sampling frequency. A typical normalized Higher Freq in the last band is 0.49.

Default: Multiband

## band parameters

An array of clusters in which each cluster contains the necessary information associated with each band for the FIR design.

If this array does not contain any elements, the node returns an error as well as NaN for ripple.

Specifying Values for band parameters

For each band, Higher Freq must be greater than Lower Freq, as shown by the following relationship.

${f}_{{h}_{i}}>{f}_{{l}_{i}}$

for $i=0,1,2,...,m-1$

where

• ${f}_{{h}_{i}}$ is the Higher Freq in the ith band
• ${f}_{{l}_{i}}$ is the Lower Freq in the ith band
• m is the number of bands

For adjacent bands, the Lower Freq in the higher band must be greater than the Higher Freq in the adjacent lower band, as shown by the following relationship:

${f}_{{l}_{i}}>{f}_{{h}_{i-1}}$

for $i=0,1,2,...,m-1$

where

• ${f}_{{l}_{i}}$ is the Lower Freq in the higher of the adjacent bands
• ${f}_{{h}_{i-1}}$is the Higher Freq in the lower of the adjacent bands
• m is the number of bands

The Higher Freq in the last band must be equal to or less than half of sampling frequency.

If any of the preceding frequency conditions are violated, the node returns an error as well as NaN for ripple.

### Amplitude

The appropriate magnitude response, or gain, of the filter between Lower Freq and Higher Freq. A value of 1.0 corresponds to a passband, and a value of 0.0 corresponds to a stopband. If you set filter type to Differentiator, the Amplitude of a band is the slope of the frequency response in that band.

### Lower Freq

The frequency at which the band begins.

### Higher Freq

The frequency at which the band ends.

### Weighted Ripple

The weighted ripple error that this node minimizes. The higher the weight, the smaller the error in the band.

## number of taps

The total number of coefficients in the output array of FIR filter coefficients.

A tap corresponds to a multiplication and an addition. If there are n taps, every filtered sample requires n multiplications and n additions.

number of taps must be greater than 2. If it is less than or equal to 2, the node returns an error as well as an empty array for filter and NaN for ripple.

Default: 32

## error in

Error conditions that occur before this node runs. The node responds to this input according to standard error behavior.

Default: No error

## sampling frequency

Sampling frequency in Hz.

Default: 1

## filter

Output FIR filter.

### filter structure

Structure of the output filter.

This output always returns FIR.

### forward coefficients

Coefficients of the FIR filter.

### reverse coefficients

This output always returns an empty array because FIR filters do not have reverse coefficients.

### sampling frequency

The sampling frequency in Hz.

## ripple

The optimal ripple the node computes and is a measure of deviation from the ideal filter specifications.

## error out

Error information. The node produces this output according to standard error behavior.

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported