# Filters¶

This section of the library includes digital filters for performing digital signal processing operations.

## Filter (2, 2)¶

The **Filter (2, 2)** component implements a second-order
IIR filter, defined by the difference equation

## FIR Filter¶

The **FIR Filter** component implements a general
FIR filter, defined by the difference equation

The filter order \(N\) is determined polymorphically by the type of the coefficient array \(b\). The implementation of the FIR Filter component simply computes the dot product of \(b\) with the output of a Shift Register component.

For small numbers of coefficients, the \(b\) array can be written directly in the containing diagram by using the
*Pack Block* primitive with *Literal* primitives as inputs. For larger coefficient arrays, it is easier to create a
case table and use it in the containing diagram with an *Index* primitive as the
table input.

## Filter¶

The **Filter** component implements a general IIR filter, defined by the difference equation

The feedback filter order \(M\) and feedforward filter order \(N\) are determined polymorphically by the types of the coefficient arrays \(a\) and \(b\), respectively. For the sake of clarity of implementation, this component does not include an \(a_0\) parameter; the coefficients are assumed to be normalized so that \(a_0 = 1\).

This is a general filter component designed to allow writing many common types of 1-D linear filter. The Filter (2, 2) and FIR Filter components provide special cases that have simpler implementations than this component.