Allpass Filter
Singlesection or multiplesection allpass filter
 Library:
DSP System Toolbox / Filtering / Filter Implementations
Description
The Allpass Filter block filters each channel of the input signal independently using a singlesection or multiplesection (cascaded) allpass filter. You can implement the allpass filter using a minimum multiplier, wave digital filter, or a lattice structure.
In minimum multiplier form, the block uses the minimum number of required multipliers, n, with 2n delay units and 2n adders. In wave digital filter form, the block uses only n multipliers and n delay units, at the expense of 3n adders. The lattice structure uses 2n multipliers, n delay units, and 2n adders. For more details on these structures, see Algorithms.
Ports
Input
x
— Input data
column vector  row vector  matrix
Input data that is passed into the allpass filter. The block accepts realvalued or complexvalued multichannel inputs, that is, mbyn size inputs, where m ≥ 1 and n ≥ 1. The block also accepts variablesize inputs. That is, you can change the size of each input channel during simulation. However, the number of channels cannot change.
This port is unnamed until you set Internal allpass
structure to Minimum
multiplier
or Lattice
, and
select the Specify coefficients from input port
parameter.
Data Types: single
 double
Complex Number Support: Yes
coeffs
— Allpass filter coefficients
column vector  row vector  matrix
This port inputs the coefficients of the allpass filter. When you set
Internal allpass structure to
Minimum multiplier
, the
coeffs port accepts matrices of size
Nby1 or Nby2. When you set
Internal allpass structure to
Lattice
, the coeffs
port accepts an Nby1 column vector or an
1byN row vector.
Dependencies
This port appears when you set Internal allpass
structure to Minimum
multiplier
or Lattice
,
and select the Specify coefficients from input
port parameter.
Data Types: single
 double
 int8
 int16
 int32
 uint8
 uint16
 uint32
Output
Port_1
— Output of the allpass filter
column vector  row vector  matrix
The size of the filtered output matches the size of the input.
Data Types: single
 double
Complex Number Support: Yes
Parameters
If a parameter is listed as tunable, then you can change its value during simulation.
Internal allpass structure
— Filter structure
Minimum multiplier
(default)  Wave Digital Filter
 Lattice
Minimum multiplier
— This structure uses the minimum number of required multipliers, n, with 2n delay units and 2n adders. The coefficients to this structure are specified through the Allpass polynomial coefficients parameter.Wave Digital Filter
— The structure uses n multipliers and n delay units, at the expense of 3n adders. The coefficients to this structure are specified through the Wave Digital Filter allpass coefficients parameter.Lattice
— The structure uses 2n multipliers, n delay units, and 2n adders. The coefficients to this structure are specified through the Lattice allpass coefficients parameter.
For more details on these structures, see Algorithms.
Specify coefficients from input port
— Flag to specify allpass polynomial coefficients
off (default)  on
When you select this check box and set Internal allpass
structure to Minimum multiplier
,
the allpass polynomial coefficients are input through the
coeffs port. When you clear this check box, the
allpass polynomial coefficients are specified on the block dialog through
the Allpass polynomial coefficients parameter.
When you select this check box and set Internal allpass
structure to Lattice
, the lattice
allpass coefficients are input through the coeffs port.
When you clear this check box, the lattice allpass coefficients are
specified on the block dialog through the Lattice allpass
coefficients parameter.
Dependencies
This parameter applies when you set Internal allpass
structure to Minimum
multiplier
or
Lattice
.
Allpass polynomial coefficients
— Coefficients in minimum multiplier form
[2^(1/2), 1/2]
(default)  Nby1 matrix  Nby2 matrix
Specify the real allpass polynomial filter coefficients in minimum multiplier form as an Nby1 matrix or an Nby2 matrix.
Nby1 matrix — The block realizes N firstorder allpass sections.
Nby2 matrix — The block realizes N secondorder allpass sections.
The default value, [ 2^(1/2), 1/2 ]
,
defines a stable secondorder allpass filter with poles and zeros at
±π/3 in the zplane.
Tunable: Yes
Dependencies
To enable this parameter, set Internal allpass
structure to Minimum
multiplier
and clear the Specify
coefficients from input port parameter.
Wave Digital Filter allpass coefficients
— Coefficients in wave digital filter form
[1/2, 2^(1/2)/3]
(default)  Nby1 matrix  Nby2 matrix
Specify the real allpass filter coefficients in wave digital filter form.
The coefficients can be Nby1 matrix for
N firstorder allpass sections and
Nby2 matrix for N secondorder
allpass sections. The default value, [1/2, 2^(1/2)/3]
,
is a transformed version of the default value of allpass polynomial
coefficients. This value is computed using allpass2wdf(Allpass
polynomial coefficients)
. These coefficients define the same
stable secondorder allpass filter as when the allpass structure is set to
Minimum multiplier
.
Tunable: Yes
Dependencies
To enable this parameter, set Internal allpass
structure to Wave Digital
Filter
.
Indicate if last section is first order
— Is last section first order
off (default)  on
on — When you set select this check box, the last section is considered first order. Also, the second element of the last row of the Nby2 matrix is ignored.
off — When you do not select this check box, the last section is considered secondorder.
Dependencies
To enable this parameter, set Internal allpass
structure to Minimum
multiplier
or Wave Digital
Filter
.
Lattice allpass coefficients
— Coefficients in lattice form
[2^(1/2)/3, 1/2]
(default)  Nby1 column vector  1byN row vector
Specify the real or complex allpass coefficients as lattice reflection
coefficients. The default value, [2^(1/2)/3, 1/2]
, is a
transformed and transposed version of the default value of the allpass
polynomial coefficients. This value is computed using
transpose(tf2latc(1, [1 A]))
, where
A is the value specified in Allpass
polynomial coefficients.
Tunable: Yes
Dependencies
To enable this parameter, set Internal allpass
structure to Lattice
and clear
the Specify coefficients from input port
parameter.
View Filter Response
— Visualize filter response
button
Opens the Filter Visualization Tool, fvtool
, and
displays the magnitude response of the allpass filter. The response is based
on the parameters. Changes made to these parameters update
fvtool
.
To update the magnitude response while fvtool
is
running, modify the block parameters and click
Apply.
To view the magnitude response and phase response simultaneously, click the Magnitude and Phase responses button on the toolbar.
In this example, the magnitude response is flat and the phase response varies with frequencies. This varying phase response has applications in phase equalization, notch filtering, and multirate filtering. You can realize a lowpass filter using a parallel combination of two allpass filters that have 180 degrees of phase shift with respect to each other.
Simulate using
— Type of simulation to run
Code generation
(default)  Interpreted execution
Specify the type of simulation to run as one of the following:
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 simulation speed thanInterpreted execution
.Interpreted execution
–– Simulate model using the MATLAB^{®} interpreter. This option shortens startup time but has slower simulation speed thanCode generation
.
Block Characteristics
Data Types 

Multidimensional Signals 

VariableSize Signals 

Algorithms
The transfer function of an allpass filter is given by
$$H(z)=\frac{c(n)+c(n1){z}^{1}+\mathrm{...}+{z}^{n}}{1+c(1){z}^{1}+\mathrm{...}+c(n){z}^{n}}$$.
c is allpass polynomial coefficients vector. The order, n, of the transfer function is the length of vector c.
In the minimum multiplier form and wave digital form, the allpass filter is implemented as a cascade of either secondorder (biquad) sections or firstorder sections. When the coefficients are specified as an Nby2 matrix, each row of the matrix specifies the coefficients of a secondorder filter. The last element of the last row can be ignored based on the trailing firstorder setting. When the coefficients are specified as an Nby1 matrix, each element in the matrix specifies the coefficient of a firstorder filter. The cascade of all the filter sections forms the allpass filter.
In the lattice form, the coefficients are specified as a vector.
These structures are computationally more economical and structurally more stable compared to the generic IIR filters, such as df1, df1t, df2, df2t. For all structures, the allpass filter can be a singlesection or a multiplesection (cascaded) filter. The different sections can have different orders, but they are all implemented according to the same structure.
Minimum Multiplier
This structure realizes the allpass filter with the minimum
number of required multipliers, equal to the order n
.
It also uses 2n
delay units and 2n
adders.
The multipliers uses the specified coefficients, which are equal to
the polynomial vector c in the allpass transfer
function. In this secondorder section of the minimum multiplier structure,
the coefficients vector, c, is equal to [0.1
0.7
].
Wave Digital Filter
This structure uses n
multipliers, but only n
delay
units, at the expense of requiring 3n
adders. To
use this structure, specify the coefficients in wave digital filter
(WDF) form. Obtain the WDF equivalent of the conventional allpass
coefficients using allpass2wdf(allpass_coefficients)
.
To convert WDF coefficients into the equivalent allpass polynomial
form, use wdf2allpass(WDF coefficients)
. In this
secondorder section of the WDF structure, the coefficients vector w is
equal to allpass2wdf([0.1 0.7])
.
Lattice
This lattice structure uses 2n
multipliers, n
delay
units, and 2n
adders. To use this structure, specify
the coefficients as a vector.
You can obtain the lattice equivalent of the conventional allpass
coefficients using transpose(tf2latc(1, [1 allpass_coefficients]))
.
In the following secondorder section of the lattice structure, the
coefficients vector is computed using transpose(tf2latc(1,
[1 0.1 0.7]))
. Use these coefficients for a filter that
is functionally equivalent to the minimum multiplier structure with
coefficients [0.1 0.7].
References
[1] Regalia, Philip A., Sanjit K. Mitra, and P.P.Vaidyanathan. “The Digital AllPass Filter: A Versatile Signal Processing Building Block.” Proceedings of the IEEE. 76, no. 1 (1988): 19–37.
[2] Lutovac, M., D. Tosic, and B. Evans. Filter Design for Signal Processing Using MATLAB and Mathematica. Upper Saddle River, NJ: Prentice Hall, 2001.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced in R2016b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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)