Documentation Center

  • Trial Software
  • Product Updates

Contents

dsp.AllpassFilter System object

Package: dsp

Single section or cascaded allpass filter

Description

The AllpassFilter object filters each channel of the input using Allpass filter implementations.

To filter each channel of the input:

  1. Define and set up your Allpass filter. See Construction.

  2. Call step to filter each channel of the input according to the properties of dsp.AllpassFilter. The behavior of step is specific to each object in the toolbox.

Construction

H = dsp.AllpassFilter returns an Allpass filter System object™, H, that filters each channel of the input signal independently using an allpass filter, with the default structure and coefficients.

H = dsp.AllpassFilter('PropertyName',PropertyValue, ...) returns an Allpass filter System object, H, with each property set to the specified value.

Properties

Structure

Internal allpass filter structure

You can specify the internal allpass filter implementation structure as one of | Minimum multiplier | Wave Digital Filter | Lattice. The default is Minimum multiplier. Each structure uses a different set of coefficients, independently stored in the corresponding object property.

AllpassCoefficients

Allpass polynomial coefficients

Specify the real allpass polynomial filter coefficients. This property is applicable only when the Structure property is set to Minimum multiplier. The value of this property can be either a row vector (single-section configuration), or a cell array with as many cells as filter sections. The default value of this property is [–0.7071, 0.5000]. They define a stable second-order allpass filter with poles and zeros located at ±π/3 in the Z plane. This property is tunable.

WDFCoefficients

Wave Digital Filter allpass coefficients

Specify the real allpass coefficients in the Wave Digital Filter form. This property is only applicable when the Structure property is set to Wave Digital Filter. The value of this property can be either a row vector (single-section configuration) or a cell array with as many cells as there are filter sections. Acceptable section orders are 1, 2 and 4. If the order is 4, then the second and fourth coefficients must be zeros. All elements must have absolute value ≤1. The default value for this property is [0.5, –1.1547]. These are the transformed versions of the default value of AllpassCoefficients, so they define the same stable second-order allpass filter with Structure set to 'Wave Digital Filter'. This property is tunable.

LatticeCoefficients

Lattice allpass coefficients

Specify the real or complex allpass coefficients as lattice reflection coefficients. This property is applicable only if the Structure property is set to Lattice. The value of this property can be either a row vector (single-section configuration) or a cell array with as many cells as filter sections. The default value for this property is [–1.1547, 0.5]. These are the transformed versions of the default value of AllpassCoefficients, so they define the same stable second-order allpass filter when Structure is set to 'Lattice'. This property is tunable.

InitialConditions

Initial values of filter states

Specify the initial values of the internal filter states. The default value of this property is 0. Acceptable values include numeric scalar, numeric 1-D or 2-D array, and cell array with as many cells as filter sections. The numeric scalar is used for all filter states, and the numeric 1-D or 2-D array is single-section only. The inner dimensions must match exactly those of the internal filter states.

Methods

cloneCreate System object with same property values
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
resetReset internal states of a System object
step Process inputs using allpass filter

More Analysis Methods for Filter System Objects.

Examples

expand all

Using allpass filter to boost frequency component of a random signal

Use a Regalia shelving structure with a first-order allpass filter to boost frequency components of a random signal. This signal is below 10 kHz by 6 dB.

       Fs = 48000;    % in Hz
       wc = 2*pi*10000;
       Vo = 2;        % 6 dB
       c =  -(2-wc/Fs)/(2+wc/Fs);
       hAP = dsp.AllpassFilter('AllpassCoefficients',  c);
       hSR = dsp.SignalSource(randn(4096, 1), 128);
       hLOG = dsp.SignalSink;
       while ~isDone(hSR)
           in = step(hSR);
           shelvedOut = -(1-Vo)/2 * step(hAP, in) + (1+Vo)/2 * in;
           step(hLOG, [in, shelvedOut]);
       end
       signalTraces = hLOG.Buffer;
       figure
       tfestimate(signalTraces(:,1), signalTraces(:,2),[],[],[],Fs)

Algorithms

The transfer function of an allpass filter is defined by:

given the nontrivial polynomial coefficients in c. The order n of the transfer function is given by the length of the vector c.

dsp.AllpassFilter realizes an allpass filter using three different implementation structures: Minimum multiplier, Wave Digital Filter, and Lattice. These structures differ from generic IIR filters such as df1, df1t, df2, df2t, in that they are computationally more economical and structurally more stable [1]. For all structures, a single instance of dsp.AllpassFilter can handle either a single-section or a multiple-section (cascaded) allpass 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 coefficients used by the multipliers are the same as AllpassCoefficients, which are equal to the polynomial vector c in the allpass transfer function. The following code shows an example of a second-order section as a Simulink diagram using basic building blocks. You need a Simulink license to generate the actual diagram using realizemdl.

hap = dsp.AllpassFilter('AllpassCoefficients', [0.1, -0.7]);
realizemdl(hap)

Wave Digital Filter

This structure uses n multipliers, but only n delay units at the expense of requiring 3n adders. To use this structure, you must specify the coefficients as WDFCoefficients in Wave Digital Filter (WDF) form. Obtain the WDF equivalent of the conventional allpass coefficients such as those in vector c in the preceding equation, by using the static method dsp.AllpassFilter.poly2wdf. You can also use a similar method, dsp.AllpassFilter.wdf2poly to convert given WDF-form coefficients into their equivalent allpass polynomial form. The following code shows an example of a second-order section as a Simulink diagram using basic operation blocks. You need a Simulink license to generate the actual diagram using realizemdl. Use these coefficients for a functionally equivalent filter to the previous Minimum multiplier example.

c = [0.1, -0.7];
w = dsp.AllpassFilter.poly2wdf(c);
hap = dsp.AllpassFilter('Structure', 'Wave Digital Filter', 'WDFCoefficients', w);
realizemdl(hap)

The multipliers used in the filter implementation are a transformation of the WDF coefficients previously provided. The implementation structure around each multiplier depends on the actual value of the multiplier and can vary for different filtering stages among five different options. For example notice how in the preceding diagram, the first and the second stages are realized with two different inner structures. For more details refer to [2].

Lattice

This lattice structure uses 2n multipliers, n delay units, and 2n adders. To use this structure, you must specify the coefficients as LatticeCoefficients in Lattice form. Obtain these from the conventional polynomial form of the allpass coefficients by using an appropriate conversion function, such as tf2latc. The following code shows an example of a second-order section as a Simulink diagram using basic operation blocks. You need a Simulink license to generate the actual diagram using realizemdl. Use these coefficients for a functionally equivalent filter to the Minimum multiplier structure.

c = [0.1 -0.7];
k = tf2latc([1 c]);
hap = dsp.AllpassFilter('Structure', 'Lattice', 'LatticeCoefficients', k);
realizemdl(hap)

References

[1] Regalia, Philip A. and Mitra Sanjit K. and Vaidyanathan, P. P. (1988) "The Digital All-Pass Filter: AVersatile Signal Processing Building Block." Proceedings of the IEEE, Vol. 76, No. 1, 1988, pp. 19–37

[2] M. Lutovac, D. Tosic, B. Evans, Filter Design for Signal Processing Using MATLAB and Mathematica. Prentice Hall, 2001

See Also

|

Was this topic helpful?