IIR Halfband Interpolator
Interpolate signal using polyphase IIR halfband filter
Libraries:
DSP System Toolbox /
Filtering /
Multirate Filters
Description
The IIR Halfband Interpolator block performs efficient polyphase interpolation of the input signal by a factor of 2. To design the halfband filter, you can use an elliptic design or a quasilinear 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 the quasilinear design. Quasilinear 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 a wave digital form.
You can also use the block to implement the synthesis portion of a twoband filter bank to synthesize a signal from lowpass and highpass subbands.
Examples
Design and Implement IIR Halfband Interpolator in Simulink
Design and implement an IIR halfband interpolator using the IIR Halfband Interpolator block. Pass a noisy input through the interpolator. Plot the spectrum of the input and the interpolated output in the spectrum analyzer.
Open and inspect the model. The input is a noisy sinusoidal signal with two frequencies, one at 1 kHz and the other at 15 kHz. Add white Gaussian noise with a mean of 0 and a variance of 0.05 to this signal.
The IIR halfband interpolator has a transition width of 4.1 kHz and a stopband attenuation of 80 dB. Visualize the magnitude response of the filter by clicking the View Filter Response button in the block dialog box.
Pass the noisy sinusoidal signal through the interpolator. Plot the spectrum of the input and the interpolated output in the spectrum analyzer.
Extract Low Frequency Subband From Speech in Simulink
Since R2023b
Use the IIR Halfband Decimator and IIR Halfband Interpolator blocks to extract and reconstruct the lowfrequency subband from a speech signal.
Open and inspect the model. The input audio data is a singlechannel speech signal with the sample rate of 22050 Hz.
Specify the Sample rate mode parameter of the IIR Halfband Decimator and IIR Halfband Interpolator blocks to Use normalized frequency (0 to 1)
. This option enables you to specify the transition width of the decimation and interpolation filters in normalized frequency units. Set the transition width to 0.093 in normalized frequency units and the stopband attenuation to 80 dB. The design method is Elliptic
by default.
Read the speech signal from the audio file in frames of 1024 samples. The IIR Halfband Decimator block extracts and outputs the lowpass subband of the speech signal. The IIR Halfband Interpolator block reconstructs the lowpass approximation of the speech signal by interpolating the lowpass subband.
The Audio Device Writer block plays the filtered output.
Design and Implement TwoChannel IIR Filter Bank in Simulink
Use the IIR Halfband Decimator and IIR Halfband Interpolator blocks to implement a twochannel filter bank. This example uses an audio file input and shows that the power spectrum of the filter bank output does not differ significantly from the input. Play the output of the filter bank using the Audio Device Writer block.
Open and inspect the model. The input audio data is a singlechannel speech signal with a sample rate of 22050 Hz.
The IIR Halfband Decimator block acts as an IIR halfband analysis bank as the Output highpass subband parameter is selected in the block dialog box. The IIR Halfband Interpolator block acts as an IIR halfband synthesis bank as the Input highpass subband parameter is selected in the block dialog box.
Set the Sample rate mode parameter in the IIR Halfband Decimator and IIR Halfband Interpolator blocks to Inherit from input port
so that the blocks inherit the sample rate from the respective input ports. Set the transition width to 4.1 kHz and the stopband attenuation to 80 dB. The design method is set to Elliptic
by default.
Read the speech signal from the audio file in frames of 1024 samples. The IIR halfband analysis filter bank extracts the lowpass and highpass subbands of the speech signal. The IIR halfband synthesis filter bank synthesizes the speech signal from the lowpass and highpass subbands.
Display the power spectrum of the audio input and the output from the synthesis filter bank in the spectrum analyzer. Play the synthesized speech signal using the Audio Device Writer block.
Ports
Input
LP — Data input
column vector  matrix
Specify the data input as a vector or a matrix. If the input signal is a matrix, the block treats each column of the matrix as an independent channel.
When you select the Input highpass subband parameter, this block acts as a halfband synthesis filter bank. The input at this port is then the lowpass subband output of a halfband analysis filter bank.
This port is unnamed until you select the Input highpass subband parameter.
Data Types: single
 double
Complex Number Support: Yes
HP — Second input to the synthesis filter bank
column vector  matrix
Specify the second input to the synthesis filter bank as a column vector or a matrix. This signal is the highpass subband output of a halfband analysis filter bank. If the input signal is a matrix, the block treats each column of the matrix as an independent channel.
The size, data type, and complexity of both the inputs must be the same.
Dependency
To enable this port, select the Input highpass subband parameter.
Data Types: single
 double
Complex Number Support: Yes
coeffs1 — Branch 1 allpass polynomial coefficients
Nby1
vector  Nby2
matrix
Specify the allpass polynomial filter coefficients of the first branch
as an Nby1
vector or
Nby2
matrix of
N firstorder or secondorder allpass
sections.
Dependencies
To enable this parameter, set:
Filter specification to
Coefficients
Internal allpass structure to
Minimum multiplier
Clear the Make the first branch a pure delay parameter
Select the Specify coefficients from input port parameter
Data Types: single
 double
coeffs2 — Branch 2 allpass polynomial coefficients
Nby1
vector  Nby2
matrix
Specify the allpass polynomial filter coefficients of the second
branch as an Nby1
vector or
Nby2
matrix of
N firstorder or secondorder allpass
sections.
Dependencies
To enable this parameter, set:
Filter specification to
Coefficients
Internal allpass structure to
Minimum multiplier
Select the Specify coefficients from input port parameter
Data Types: single
 double
Output
Output — Output of interpolator
column vector  matrix
Output of the interpolator, returned as a column vector or a matrix. The number of rows in the interpolator output is twice the number of rows in the input signal.
Data Types: single
 double
Parameters
Filter specification — Filter design parameters
Transition width and stopband
attenuation
(default)  Filter order and stopband attenuation
 Filter order and transition width
 Coefficients
Select the parameters that the block uses 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
4.1e3
(default)  positive scalar
Specify the transition width of the IIR halfband filter as a positive scalar in Hz or in normalized frequency units (since R2023b).
If you set the Sample rate mode parameter to:
Specify on dialog
orInherit from input port
–– The value of the transition width is in Hz and must be less than half the value of the output sample rate (2 × input sample rate).Use normalized frequency (0 to 1)
–– The value of the transition width is in normalized frequency units. The value must be a positive scalar less than1.0
.
(since R2023b)
Dependencies
To enable this parameter, set Filter
specification to Filter order and transition
width
or Transition width and stopband
attenuation
.
Filter order — Order of the IIR halfband filter
9 (default)  positive integer
Specify the filter order as a 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 Quasilinear
phase
, then Filter order must be a
multiple of four.
Dependencies
To enable this parameter, set Filter
specification to Filter order and transition
width
or Filter order and stopband
attenuation
.
Stopband attenuation (dB) — Minimum attenuation needed in stopband
80 (default)  positive real scalar
Specify the minimum attenuation needed in the stopband of the IIR halfband filter as a real positive scalar in dB.
Dependencies
To enable this parameter, set Filter
specification to Filter order and stopband
attenuation
or Transition width and
stopband attenuation
.
Design method — Design method
Elliptic
(default)  Quasilinear phase
Specify the design method for the IIR halfband filter.
Elliptic
(default) — The filter has a nonlinear phase and uses few coefficients.Quasilinear phase
— The first branch of the polyphase filter structure is a pure delay, which results in an approximately linear phase response.
Dependencies
To enable this parameter, set Filter
specification to any option except
Coefficients
.
Internal allpass structure — Filter structure in coefficient mode
Minimum multiplier
(default)  Wave Digital Filter
Specify the internal allpass filter implementation structure as
Minimum multiplier
or Wave
Digital Filter
. Each structure uses a different
coefficients set, independently stored in the corresponding coefficients
property. The default is Minimum
multiplier
.
Dependencies
To enable this parameter, set Filter
specification to
Coefficients
.
Make the first branch a pure delay — Make the first branch a pure delay
off
(default)  on
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.
By default, this check box is not selected.
Dependencies
To enable this parameter, set Filter
specification to
Coefficients
.
Delay length in samples for branch 1 — Length of the delay
1
(default)  finite positive scalar
Specify the length of the first branch delay as a finite positive scalar.
The default is 1
.
Dependencies
To enable this parameter, set:
Filter specification to
Coefficients
Select the Make the first branch a pure delay parameter
Specify coefficients from input port — Specify coefficients from input port
off
(default)  on
When you select this check box, you can input the branch 1 allpass polynomial coefficients and branch 2 allpass polynomial coefficients through the input ports coeffs1 and coeffs2. When you clear this check box, you specify the coefficients in the block dialog box through the Branch 1 allpass polynomial coefficients and Branch 2 allpass polynomial coefficients parameters.
Dependencies
To enable this parameter, set:
Filter specification to
Coefficients
Internal allpass structure to
Minimum multiplier
Branch 1 allpass polynomial coefficients — Allpass polynomial filter coefficients of first branch
[0.1284563; 0.7906755]
(default)  Nby1
 Nby2
Specify the allpass polynomial filter coefficients of the first branch as
an Nby1
vector or
Nby2
matrix of
N firstorder or secondorder allpass
sections.
This parameter is tunable, that is, you can change its value during simulation.
Dependencies
To enable this parameter, set:
Filter specification to
Coefficients
Internal allpass structure to
Minimum multiplier
Clear the Make the first branch a pure delay parameter
Clear the Specify coefficients from input port parameter
Branch 2 allpass polynomial coefficients — Allpass polynomial filter coefficients of second branch
[0.4295667]
(default)  Nby1
 Nby2
Specify the allpass polynomial filter coefficients of the second branch as
an Nby1
vector or
Nby2
matrix of
N firstorder or secondorder allpass
sections.
This parameter is tunable, that is, you can change its value during simulation.
Dependencies
To enable this parameter, set:
Filter specification to
Coefficients
Internal allpass structure to
Minimum multiplier
Clear the Specify coefficients from input port parameter
Branch 1 Wave Digital coefficients — Allpass filter coefficients of first branch in wave digital filter form
[0.1284563; 0.7906755]
(default)  Nby1
 Nby2
Specify the allpass filter coefficients of the first branch in wave
digital filter (WDF) form as an Nby1
vector or Nby2
matrix of
N firstorder or secondorder allpass
sections.
The magnitude of each WDF coefficient must not be greater than 1.
Dependencies
To enable this parameter, set:
Filter specification to
Coefficients
Internal allpass structure to
Wave Digital Filter
Clear the Make the first branch a pure delay parameter
Branch 2 Wave Digital coefficients — Allpass filter coefficients of second branch in wave digital filter form
[0.4295667]
(default)  Nby1
 Nby2
Specify the allpass filter coefficients of the second branch in wave
digital filter (WDF) form as an Nby1
vector or Nby2
matrix of
N firstorder or secondorder allpass
sections.
The magnitude of each WDF coefficient must not be greater than 1.
Dependencies
To enable this parameter, set:
Filter specification to
Coefficients
Internal allpass structure to
Wave Digital Filter
Last section of branch 2 is first order — Make the last section of the second branch as first order
off
(default)  on
When you select this check box, the block treats the last section of the
second branch as a first order section. When the coefficients of the second
branch are in an Nby2
matrix, the
block ignores the second element of the last row of the matrix. The last
section of the second branch then becomes a firstorder section.
When you clear this check box, the block treats the last section of the
second branch as a secondorder section. When the coefficients of the second
branch are in an Nby1
matrix, the
block ignores this parameter.
By default, this check box is cleared.
Dependencies
To enable this parameter, set Filter
specification to
Coefficients
.
Input highpass subband — Input highpass subband
off
(default)  on
When you select this check box, the block acts as a synthesis filter bank. The block accepts two inputs to synthesize: lowpass and highpass subbands. When you clear this check box, the block acts as an IIR halfband interpolator and accepts a single vector or matrix as input. By default, this check box is cleared.
Sample rate mode — Mode to specify the input sample rate
Specify on dialog
(default)  Inherit from input port
 Use normalized frequency (0 to 1)
Since R2023b
Specify the input sample rate using one of these options:
Specify on dialog
–– Specify the input sample rate in the block dialog box using the Input sample rate (Hz) parameter.Inherit from input port
–– The block inherits the sample rate from the input signal.Use normalized frequency (0 to 1)
–– Specify the passbandedge and the stopbandedge frequencies in normalized frequency units (0 to 1).
Dependencies
To enable this parameter, set Filter
specification to any value other than
Coefficients
.
Input sample rate (Hz) — Sample rate of input signal
22050 (default)  positive real scalar
Specify the sample rate of the input signal as a scalar in Hz.
Dependencies
To enable this parameter, set:
Filter specification to any value other than
Coefficients
.Sample rate mode to
Specify on dialog
.
(since R2023b)
View Filter Response — View Filter Response
button
Click this button to open the Filter Visualization Tool (FVTool) and display the magnitude and phase response of the IIR Halfband Interpolator. The response is based on the values you specify in the block parameters dialog box. Changes made to these parameters update FVTool.
To update the magnitude response while FVTool is running, modify the dialog box parameters and click Apply.
Simulate using — Type of simulation to run
Interpreted execution
(default)  Code generation
Specify the type of simulation to run. You can set this parameter to:
Interpreted execution
–– Simulate model using the MATLAB^{®} interpreter. This option shortens startup time.Code generation
–– 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 subsequent simulations.
Block Characteristics
Data Types 

Direct Feedthrough 

Multidimensional Signals 

VariableSize Signals 

ZeroCrossing Detection 

Algorithms
Polyphase Implementation with Halfband Filters
When you filter your signal, the IIR halfband interpolator uses an efficient polyphase implementation for halfband filters. You can use a polyphase implementation to move the upsampling operation after filtering. This change enables you to filter at a lower sampling rate.
IIR halfband filters are generally modeled using two parallel allpass filter branches.
$$H(z)=0.5*[{A}_{1}({z}^{2})+{z}^{1}{A}_{2}({z}^{2})]$$
Elliptic Design
The allpass filters for elliptic IIR halfband filter are given as
$${A}_{1}(z)={\displaystyle \prod _{k=1}^{{K}_{1}}\frac{{a}_{k}^{(1)}+{z}^{1}}{1+{a}_{k}^{(1)}{z}^{1}}}$$
$${A}_{2}(z)={\displaystyle \prod _{k=1}^{{K}_{2}}\frac{{a}_{k}^{(2)}+{z}^{1}}{1+{a}_{k}^{(2)}{z}^{1}}}$$
QuasiLinear Phase Design
A nearlinear phase response for IIR halfband filters is achieved by making one of the branches a pure delay. In this design, the cost of the filter increases.
The allpass filters for quasilinear phase IIR halfband filter are
$${A}_{1}(z)={z}^{k}$$
where, k is the length of the delay.
$${A}_{2}(z)={\displaystyle \prod _{K=1}^{{K}_{2}^{(1)}}\frac{{a}_{k}+{z}^{1}}{1+{a}_{k}{z}^{1}}}{\displaystyle \prod _{K=1}^{{K}_{2}^{(2)}}\frac{{c}_{k}+{b}_{k}{z}^{1}+{z}^{2}}{1+{b}_{k}{z}^{1}+{c}_{k}{z}^{2}}}$$
where N is the order of the IIR halfband filter.
You can represent the upsamplingby2 operation followed by the filtering operation using this figure.
Using the multirate noble identity for upsampling, you can move the upsampling operation after filtering. This enables you to filter at a lower rate.
To efficiently implement the halfband interpolator, this algorithm replaces the upsampling operator, delay block, and adder with a commutator switch. The commutator switch starts on the first branch and takes input samples from the two branches alternately, one sample at a time. This doubles the sampling rate of the input signal. This is shown in the following figure.
Synthesis Filter Bank
Transfer function of the complementary highpass filter branch of the synthesis filter bank is given by
$$G(z)=0.5*[{A}_{1}({z}^{2}){z}^{1}{A}_{2}({z}^{2})]$$
You can represent the synthesis filter bank as in this diagram.
The IIR halfband interpolator implements the synthesis portion of a twoband filter bank to synthesize a signal from lowpass and highpass subbands.
For more information on filter banks, see Overview of Filter Banks.
To summarize, the IIR halfband interpolator:
Filters the input before upsampling
Acts as a synthesis filter bank
Has a nonlinear phase response and uses few coefficients with the elliptic design method
Has nearlinear phase response at the cost of additional coefficients with the quasilinear phase design method, where one of the branches is a pure delay
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced in R2015bR2024a: Change in the default value of Simulate using parameter
The default value of the Simulate using parameter is now
Interpreted execution
. With this change, the block uses the
MATLAB interpreter for simulation by default.
R2023b: Support for normalized frequencies
When you set the Sample rate mode parameter to
Use normalized frequency (0 to 1)
, you can specify
the transition width in normalized frequency units (0 to 1).
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 MATLAB 명령을 지원하지 않습니다.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
 América Latina (Español)
 Canada (English)
 United States (English)
Europe
 Belgium (English)
 Denmark (English)
 Deutschland (Deutsch)
 España (Español)
 Finland (English)
 France (Français)
 Ireland (English)
 Italia (Italiano)
 Luxembourg (English)
 Netherlands (English)
 Norway (English)
 Österreich (Deutsch)
 Portugal (English)
 Sweden (English)
 Switzerland
 United Kingdom (English)