# dsp.FIRDecimator

Polyphase FIR decimator

## Description

The `dsp.FIRDecimator`

System object™ resamples vector or matrix inputs along the first dimension. The FIR decimator
(as shown in the schematic) conceptually consists of an anti-aliasing FIR filter followed by a
downsampler.

The FIR filter filters the data in each channel of the input using a direct-form FIR
filter. The FIR filter coefficients can be specified through the
`Numerator`

property, or can be automatically designed by the object
using the `designMultirateFIR`

function. The
`designMultirateFIR`

function designs an anti-aliasing FIR filter. The
downsampler that follows the FIR filter downsamples each channel of filtered data by taking
every *M*-th sample and discarding the *M* – 1 samples that follow. *M* is the value of the decimation
factor that you specify. The resulting discrete-time signal has a sample rate that is
1/*M* times the original sample rate.

Note that the actual object algorithm implements a direct-form FIR polyphase structure, an efficient equivalent of the combined system depicted in the diagram. For more details, see Algorithms.

To resample vector or matrix inputs along the first dimension:

Create the

`dsp.FIRDecimator`

object and set its properties.Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Under specific conditions, this System object also supports SIMD code generation. For details, see Code Generation.

## Creation

### Syntax

### Description

returns an FIR
decimator object with a decimation factor of 2. The object designs the FIR filter
coefficients using the `firdecim`

= dsp.FIRDecimator`designMultirateFIR(1,2)`

function.

returns an FIR decimator with the integer-valued `firdecim`

= dsp.FIRDecimator(`M`

)`DecimationFactor`

property set to `M`

. The object designs its filter coefficients based
on the decimation factor `M`

that you specify while creating the
object, using the `designMultirateFIR(1,M)`

function. The designed
filter corresponds to a lowpass with a cutoff at π/`M`

in radial
frequency units.

returns an FIR decimator with the `firdecim`

= dsp.FIRDecimator(`M`

,`'Auto'`

)`NumeratorSource`

property set to
`'Auto'`

. In this mode, every time there is an update in the
decimation factor, the object redesigns the filter using
`designMultirateFIR(1,M)`

.

returns an FIR decimator with the `firdecim`

= dsp.FIRDecimator(`M`

,`num`

)`DecimationFactor`

property set to
`M`

and the `Numerator`

property set to
`num`

.

returns an FIR decimator object with each specified property set to the specified value.
Enclose each property name in quotes. You can use this syntax with any previous input
argument combinations.`firdecim`

= dsp.FIRDecimator(___,`Name,Value`

)

returns an FIR decimator where the filter coefficients are designed using
`firdecim`

= dsp.FIRDecimator(`M`

,`'legacy'`

)`fir1(35,0.4)`

. The designed filter has a cutoff frequency of 0.4π
radians/sample.

## Properties

## Usage

### Description

### Input Arguments

### Output Arguments

## Object Functions

To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named `obj`

, use
this syntax:

release(obj)

## Examples

## More About

## Algorithms

The FIR decimation filter is implemented efficiently using a polyphase structure. For more details on polyphase filters, see Polyphase Subfilters.

To derive the polyphase structure, start with the transfer function of the FIR filter:

$$H(z)={b}_{0}+{b}_{1}{z}^{-1}+\mathrm{...}+{b}_{N}{z}^{-N}$$

*N*+1 is the length of the FIR filter.

You can rearrange this equation as follows:

$$H(z)=\begin{array}{c}\left({b}_{0}+{b}_{M}{z}^{-M}+{b}_{2M}{z}^{-2M}+\mathrm{..}+{b}_{N-M+1}{z}^{-(N-M+1)}\right)+\\ {z}^{-1}\left({b}_{1}+{b}_{M+1}{z}^{-M}+{b}_{2M+1}{z}^{-2M}+\mathrm{..}+{b}_{N-M+2}{z}^{-(N-M+1)}\right)+\\ \begin{array}{c}\vdots \\ {z}^{-(M-1)}\left({b}_{M-1}+{b}_{2M-1}{z}^{-M}+{b}_{3M-1}{z}^{-2M}+\mathrm{..}+{b}_{N}{z}^{-(N-M+1)}\right)\end{array}\end{array}$$

*M* is the number of polyphase components, and its value
equals the decimation factor that you specify.

You can write this equation as:

$$H(z)={E}_{0}({z}^{M})+{z}^{-1}{E}_{1}({z}^{M})+\mathrm{...}+{z}^{-(M-1)}{E}_{M-1}({z}^{M})$$

*E _{0}(z^{M})*,

*E*, ...,

_{1}(z^{M})*E*are the polyphase components of the FIR filter

_{M-1}(z^{M})*H*(z).

Conceptually, the FIR decimation filter contains a lowpass FIR filter followed by a downsampler.

Replace *H*(z) with its polyphase representation.

Here is the multirate noble identity for decimation.

Applying the noble identity for decimation moves the downsampling operation to before the filtering operation. This move enables you to filter the signal at a lower rate.

You can replace the delays and the decimation factor at the input with a commutator switch. The switch starts on the first branch 0 and moves in the counterclockwise direction as shown in this diagram. The accumulator at the output receives the processed input samples from each branch of the polyphase structure and accumulates these processed samples until the switch goes to branch 0. When the switch goes to branch 0, the accumulator outputs the accumulated value.

When the first input sample is delivered, the switch feeds this input to the branch 0 and the
decimator computes the first output value. As more input samples come in, the switch moves
in the counter clockwise direction through branches *M*−1,
*M*−2, and all the way up to branch 0, delivering one sample at a time
to each branch. When the switch comes to branch 0, the decimator outputs the next set of
output values. This process continues as data keeps coming in. Every time the switch comes
to the branch 0, the decimator outputs *y[m]*. The decimator effectively
outputs one sample for every *M* samples it receives. Hence the sample rate
at the output of the FIR decimation filter is
*fs*/*M*.

## Extended Capabilities

## Version History

**Introduced in R2012a**