Main Content

allpass2wdf

Allpass to Wave Digital Filter coefficient transformation

Description

w = allpass2wdf(a) accepts a vector of real allpass polynomial filter coefficients a, and returns the transformed coefficient w. w can be used with allpass filter objects such as dsp.AllpassFilter, and dsp.CoupledAllpassFilter, with Structure set to 'Wave Digital Filter'.

W = allpass2wdf(A) accepts the cell array of allpass polynomial coefficient vectors A. Each cell of A holds the coefficients of a section of a cascade allpass filter. W is also a cell array, and each cell of W contains the transformed version of the coefficients in the corresponding cell of A. W can be used with allpass filter objects such as dsp.AllpassFilter and dsp.CoupledAllpassFilter, with structure set to 'Wave Digital Filter'.

Examples

collapse all

Create a second order allpass filter with coefficients a = [0 0.5]. Convert these coefficients into wave digital filter form using allpass2wdf. Assign the transformed coefficients to an allpass filter using the wave digital filter structure. Pass a random input to both these filters and compare the outputs.

a = [0 0.5]; 
allpass = dsp.AllpassFilter('AllpassCoefficients', a);
w = allpass2wdf(a);
allpasswdf = dsp.AllpassFilter('Structure', 'Wave Digital Filter',...
    'WDFCoefficients', w);
in = randn(512, 1);
outputAllpass = allpass(in);
outputAllpasswdf = allpasswdf(in);
plot(outputAllpass-outputAllpasswdf)

The difference between the two outputs is very small.

Input Arguments

collapse all

Numeric vector of allpass filter coefficients, specified as real numbers. a can have length only equal to 1,2, and 4. When the length is 4, the first and third components must both be zero. a can be a row or a column vector.

Example: 0.7

Data Types: double | single

Cascade of allpass filter coefficients, specified as a cell vector. Every cell of A must contain a real vector of length 1,2, or 4. When the length is 4, the first and third components must both be zero. A can be a row or column vector of cells.

Example: {0.7, [0.1, 0.2]}

Data Types: double | single

Output Arguments

collapse all

Numeric vector of transformed coefficients, determined as a real number, to use with single-section allpass filter objects having Structure set to 'Wave Digital Filter'. w is always returned as a numeric row vector.

Example: 0.7

Data Types: double | single

Cascade of transformed allpass filter coefficients, determined as a cell array, to use with multi-section allpass filter objects having Structure set to 'Wave Digital Filter'. W is always returned as a column of cells.

Example: {0.7;[0.2,-0.0833]}

Data Types: double | single

Algorithms

In the more general case, the input coefficients A define a cascade or multisection allpass filter. allpass2wdf applies separately to each section of the same transformation used in the single-section case. In the single-section case, the numeric coefficients vector a contains a standard polynomial representation of an allpass filter of order 1, 2, or 4. For example, in the first order case,

a=[a1]

represents the first order transfer function:

H1(z)=z1+a11+a1z1

and in the second order case,

a=[a1,a2]

represents the second order transfer function:

H2(z)=z2+a1z1+a21+a1z1+a2z2

.

The allpass transfer functions H1 and H2 can also have the following alternative representations, using decoupled coefficients in vector w1 or w2 respectively.

H~1(z)=z1+w11+w1z1

H~2(z)=z2+w2(1+w1)z1+w11+w2(1+w1)z1+w1z2

For allpass coefficients, w is often used to derive adaptor multipliers for Wave Digital Filter structures, and it is required by a number of allpass based filters in DSP System Toolbox™ when Structure is set to 'Wave Digital Filter' (e.g. dsp.AllpassFilter, and dsp.CoupledAllpassFilter).

For a given vector of section coefficients a, allpass2wdf computes the corresponding vector w such that

when i = 1, 2 or 4H~i(z)=Hi(z)

This results in using the following formulas:

for order 1:w1=a1for order 2:w1=a2w2=a11+a2for order 4:w1=a4w3=a21+a4w2=w4=0

References

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

Version History

Introduced in R2014a