# IIR Halfband Decimator

Decimate signal using polyphase IIR halfband filter

## Library

Filtering/Filter Designs

`dspfdesign`

## Description

The IIR Halfband Decimator block performs polyphase decimation of the input signal by a factor of two. To design the halfband filter, you can specify the block to use an elliptic design or a quasi-linear phase design. The block uses these design methods to compute the filter coefficients. To filter the inputs, the block uses a polyphase structure. The allpass filters in the polyphase structure are in a minimum multiplier form.

Elliptic design introduces nonlinear phase and creates the filter using fewer coefficients than quasi linear design. Quasi-linear phase design overcomes phase nonlinearity at the cost of additional coefficients.

Alternatively, instead of designing the halfband filter using a design method, you can specify the filter coefficients directly. When you choose this option, the allpass filters in the two branches of the polyphase implementation can be in a minimum multiplier form or in a wave digital form.

You can also use the block to implement the analysis portion of a two-band filter bank to filter a signal into lowpass and highpass subbands.

The input signal can be a real- or complex-valued column vector or matrix. If the input signal is a matrix, each column of the matrix is treated as an independent channel. The number of rows in the input signal must be a multiple of 2.

## Parameters

Filter specification

Parameters used to design the IIR halfband filter. Because the filter design has only two degrees of freedom, you can specify only two of the three parameters:

• `Transition width and stopband attenuation` (default) — Design the filter using Transition width (Hz) and Stopband attenuation (dB). This design is the minimum order design.

• `Filter order and transition width` — Design the filter using Filter order and Transition width (Hz).

• `Filter order and stopband attenuation` — Design the filter using Filter order and Stopband attenuation (dB).

• `Coefficients`— Specify the filter coefficients directly using the enabled parameters.

Transition width (Hz)

Transition width of the IIR halfband filter, specified as a real positive scalar in Hz. The transition width must be less than half the input sample rate. This parameter applies when Filter specification is set to ```Filter order and transition width``` or ```Transition width and stopband attenuation```. The default is `4.1e3`.

Filter order

Filter order, specified as a finite positive integer. If you set Design method to `Elliptic`, then Filter order must be an odd integer greater than one. If you set Design method to `Quasi-linear phase`, then Filter order must be a multiple of four. This parameter applies when Filter specification is set to ```Filter order and transition width``` or ```Filter order and stopband attenuation```. The default is `9`.

Stopband attenuation (dB)

Minimum attenuation needed in the stopband of the IIR halfband filter, specified as a real positive scalar in dB. This parameter applies when Filter specification is set to ```Filter order and stopband attenuation``` or ```Transition width and stopband attenuation```. The default is `80`.

Design method

Design method for the IIR halfband filter.

• `Elliptic` (default) — The filter has nonlinear phase and uses few coefficients.

• `Quasi-linear phase` — The first branch of the polyphase filter structure is a pure delay, which results in an approximately linear phase response.

This parameter applies when you set Filter specification to any option except `Coefficients`.

Internal allpass structure

Internal allpass filter implementation structure, specified as ```Minimum multiplier``` or `Wave Digital Filter`. This parameter applies when you set Filter specification to `Coefficients`. Each structure uses a different coefficients set, independently stored in the corresponding coefficients property. The default is `Minimum multiplier`.

Make the first branch a pure delay

When you select this check box, the first branch of the polyphase filter structure becomes a pure delay, and the Branch 1 allpass polynomial coefficients and Branch 1 Wave Digital coefficients parameters do not apply. This parameter applies when you set Filter specification to `Coefficients`.

By default, this check box is selected.

Delay length in samples for branch 1

Length of the first branch delay, specified as a finite positive scalar. This parameter applies when you set Filter specification to `Coefficients` and select Make the first branch a pure delay. The default is `1`.

Specify coefficients from input port

When you select this check box, the branch 1 allpass polynomial coefficients and branch 2 allpass polynomial coefficients are input through the input ports coeffs1 and coeffs2. When you clear this check box, the coefficients are specified on the block dialog through the Branch 1 allpass polynomial coefficients and Branch 2 allpass polynomial coefficients parameters.

This parameter applies when you set Filter specification to `Coefficients` and Internal allpass structure to `Minimum multiplier`.

Branch 1 allpass polynomial coefficients

Allpass polynomial filter coefficients of the first branch, specified as an N-by-`1` or N-by-`2` matrix of N first-order or second-order allpass sections. This parameter applies only when you set Filter specification to `Coefficients` and Internal allpass structure to ```Minimum multiplier```. The default is [```0.1284563; 0.7906755```].

This parameter applies when you set Filter specification to `Coefficients`, set Internal allpass structure to `Minimum multiplier`, and clear the Specify coefficients from input port parameter.

This parameter is tunable. That is, you can change its value during simulation.

Branch 2 allpass polynomial coefficients

Allpass polynomial filter coefficients of the second branch, specified as an N-by-`1` or N-by-`2` matrix of N first-order or second-order allpass sections. This parameter applies only when you set Filter specification to `Coefficients` and Internal allpass structure to ```Minimum multiplier```. The default is `0.4295667`.

This parameter applies when you set Filter specification to `Coefficients`, set Internal allpass structure to `Minimum multiplier`, and clear the Specify coefficients from input port parameter.

This parameter is tunable. That is, you can change its value during simulation.

Branch 1 Wave Digital coefficients

Allpass filter coefficients of the first branch in Wave Digital Filter form, specified as an N-by-`1` or N-by-`2` matrix of N first-order or second-order allpass sections. This parameter applies only when you set Filter specification to `Coefficients` and Internal allpass structure to ```Wave Digital Filter```. The default is [`0.1284563; 0.7906755`].

This parameter applies when you set Filter specification to `Coefficients` and Internal allpass structure to `Wave Digital Filter`.

Branch 2 Wave Digital coefficients

Allpass filter coefficients of the second branch in Wave Digital Filter form, specified as an N-by-`1` or N-by-`2` matrix of N first-order or second-order allpass sections. This parameter applies only when you set Filter specification to `Coefficients` and Internal allpass structure to ```Wave Digital Filter```. The default is `0.4295667`.

This parameter applies when you set Filter specification to `Coefficients` and Internal allpass structure to `Wave Digital Filter`.

Last section of branch 2 is first order

When you select this check box, the last section of the second branch is treated as a first order section. This parameter applies only when you set Filter specification to `Coefficients`. When the coefficients of the second branch are in an N-by-`2` matrix, the block ignores the second element of the last row of the matrix. The last section of the second branch then becomes a first-order section.

When this check box is cleared, the last section of the second branch is treated as a second-order section. When the coefficients of the second branch are in an N-by-`1` matrix, the block ignores this parameter.

By default, this check box is cleared.

Output highpass subband

When you select this check box, the block acts as an analysis filter bank, producing two power-complementary outputs. When you clear this check box, the block acts as an IIR halfband decimator and accepts a single vector or matrix as input. By default, this check box is cleared.

Inherit sample rate from input

When you select this check box, the block inherits its sample rate from the input signal. The block calculates the sample rate based on the sample time of the input port. When you clear this check box, you specify the sample rate in Input sample rate (Hz).

This parameter applies when you set Filter specification to any option except `Coefficients`.

Input sample rate (Hz)

Input sample rate, specified as a scalar in Hz. The default is `44100`. You can specify an input sample rate when the Inherit sample rate from input check box is cleared.

View Filter Response

Opens the Filter Visualization Tool FVTool and displays the magnitude/phase response of the IIR Halfband Decimator. The response is based on the block dialog box parameters. Changes made to these parameters update FVTool.

To update the magnitude response while FVTool is running, modify the dialog box parameters and click .

Simulate using

Type of simulation to run. You can set this parameter to:

• `Code generation` (default)

Simulate model using generated C code. The first time you run a simulation, Simulink® generates C code for the block. The C code is reused for subsequent simulations, as long as the model does not change. This option requires additional startup time but provides faster simulation speed than `Interpreted execution`.

• `Interpreted execution`

Simulate model using the MATLAB®  interpreter. This option shortens startup time but has slower simulation speed than `Code generation`.

## Supported Data Types

PortSupported Data Types

Input

• Double-precision floating point

• Single-precision floating point

Output

• Double-precision floating point

• Single-precision floating point

 `dsp.IIRHalfbandInterpolator` DSP System Toolbox `dsp.IIRHalfbandDecimator` DSP System Toolbox IIR Halfband Interpolator DSP System Toolbox FIR Halfband Interpolator DSP System Toolbox FIR Halfband Decimator DSP System Toolbox

## Algorithms

This block brings the capabilities of the `dsp.IIRHalfbandDecimator` System object™ to the Simulink environment.

For information on the algorithms used by this block, see the Algorithms section of `dsp.IIRHalfbandDecimator`.

## Extended Capabilities

### C/C++ Code GenerationGenerate C and C++ code using Simulink® Coder™.

Introduced in R2015b

Get trial now