Contents

dsp.CoupledAllpassFilter System object

Package: dsp

Coupled allpass IIR filter

Description

The CoupledAllpassFilter object implements a coupled allpass filter structure composed of two allpass filters connected in parallel. Each allpass branch can contain multiple sections. The overall filter output is computed by adding the output of the two respective branches. An optional second output can also be returned, which is power complementary to the to the first. For example, from the frequency domain perspective, if the first output implements a lowpass filter, the second output implements the power complementary highpass filter. For real signals, the power complementary output is computed by subtracting the output of the second branch from the first. CoupledAllpassFilter supports double- and single-precision floating point and allows you to choose between different realization structures. This System object™ also supports complex coefficients, multichannel variable length input, and tunable filter coefficient values.

To filter each channel of the input:

  1. Define and set up your Coupled Allpass Filter. See Construction.

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

Construction

H = dsp.CoupledAllpassFilter returns a coupled allpass filter System object, H, that filters each channel of the input signal independently. The coupled allpass filter uses the default inner structures and coefficients.

H = dsp.CoupledAllpassFilter('PropertyName',PropertyValue, ...) returns a Coupled allpass filter System object, H, with each property set to the specified value.

H = CoupledAllpassFilter(AllpassCoefficients1,AllpassCoefficients2) returns a coupled allpass filter System object, H, with Structure set to 'Minimum multiplier'. The allpass coefficients for each of the two branches are set to their two corresponding specified values.

H = CoupledAllpassFilter(Structure,AllpassCoefficients1,AllpassCoefficients2) returns a coupled allpass filter System object, H, with Structure set to a specified value. This value can be 'Minimum multiplier' | 'Wave Digital Filter' | 'Lattice'. The coefficients relevant to the specified structure are set to the values provided.

Properties

Structure

Internal structure of allpass branches

Specify the internal structure of allpass branches as one of 'Minimum multiplier' | 'Wave Digital Filter' | 'Lattice'. Each structure uses a different pair of coefficient values, independently stored in the relevant object property.

AllpassCoefficients1

Allpass polynomial coefficients of branch 1

Specify the polynomial filter coefficients for the first allpass branch. This property is applicable only if you set the Structure property to 'Minimum multiplier'. This property can accept values either in the form of a row vector (single-section configuration) or a cell array with as many cells as filter sections. The default value is [0 0.5]. This property is tunable.

WDFCoefficients1

Wave Digital Filter coefficients of branch 1

Specify the Wave Digital Filter coefficients for the first allpass branch. This property is applicable only if you set the Structure property to 'Wave Digital Filter'. This property can accept values either in the form of a row vector (single-section configuration) or a cell array with as many cells as filter sections. The default value is [0.5 0]. This property is tunable.

LatticeCoefficients1

Lattice coefficients of branch 1

Specify the allpass lattice coefficients for the first allpass branch. This property is applicable only if you set the Structure property to 'Lattice'. This property can accept values either in the form of a row vector (single-section configuration) or a cell array with as many cells as filter sections. The default value is [0.5 0]. This property is tunable.

Delay

length in samples for branch 1

Delay is the integer number of the delay taps in the top branch. This property is applicable only if you set the PureDelayBranch property to true. This property is a scalar positive integer, and is tunable.

Gain1

Independent Branch 1 Phase Gain

Gain1 is the individual branch phase gain. This property can accept only values equal to '1', '–1', '0+i', or '0–i'. The default value is 1. This property is nontunable.

AllpassCoefficients2

Allpass polynomial coefficients of branch 2

Specify the polynomial filter coefficients for the second allpass branch. This property is applicable only if you set the Structure property to 'Minimum Multiplier'. This property can accept values either in the form of a row vector (single-section configuration) or a cell array with as many cells as filter sections. The default value is [ ]. This property is tunable.

WDFCoefficients2

Wave Digital Filter coefficients of branch 2

This property is applicable only if you set the Structure property to 'Wave Digital Filter'. This property can accept values either in the form of a row vector (single-section configuration) or a cell array with as many cells as filter sections. The default value is [ ]. This property is tunable.

LatticeCoefficients2

Lattice coefficients of branch 2

Specify the allpass lattice coefficients for the second allpass branch. This property is applicable only if you set the Structure property to 'Lattice'. This property can accept values either in the form of a row vector (single-section configuration) or a cell array with as many cells as filter sections. The default value is [ ]. This property is tunable.

Gain2

Independent Branch 2 Phase Gain

Specify the value of the independent phase gain applied to branch 2. This property can accept only values equal to '1', '–1', '0+1i' or '0–1i'. The default value is 1. This property is nontunable.

Beta

Coupled phase gain

Specify the value of the phasor gain in complex conjugate form, in each of the two branches, and in complex coefficient configuration. This property is applicable only when the selected Structure property supports complex coefficients. The absolute value of this property should be 1 and its default value is 1. This property is tunable.

PureDelayBranch

Replace allpass filter in first branch with pure delay

If you set PureDelayBranch to true, the property holding the coefficients for the first allpass branch is disabled and Delay becomes enabled. You can use this property to improve performance, when one of the two allpass branches is known to be a pure delay (e.g. for halfband filter designs)

ComplexConjugateCoefficients

Allow inferring coefficients of second allpass branch as complex conjugate of first

When the input signal is real, this property triggers the use of an optimized structural realization. This property is only enabled if the currently selected structure supports complex coefficients. Use it only if the filter coefficients are actually complex.

Methods

cloneCreate Coupled Allpass Filter System object with same property values
getBranchesReturn internal allpass branches
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
resetReset internal states of Coupled Allpass filter
stepFilter input with CoupledAllpas filter object

Examples

Allpass Realization of a Butterworth Lowpass Filter — Manual Design

Realize a Butterworth lowpass filter of order 3. Use a coupled allpass structure with inner minimum multiplier structure.

Fs = 48000;
Fc = 12000;
[b, a] = butter(3, 2*Fc/Fs);
[c1, c2] = tf2ca(b, a);
Hca = dsp.CoupledAllpassFilter(c1(2:end), c2(2:end));
Hsr = dsp.SignalSource(randn(4096, 1), 128);
Hlog = dsp.SignalSink;

After creating the filter, generate a random signal, and set up a log of the output signal, step through the System objects.

while ~isDone(Hsr)
   in = step(Hsr);
   out = step(Hca, in);
   step(Hlog, [in, out]);
end
signalTraces = Hlog.Buffer;
tfestimate(signalTraces(:,1), signalTraces(:,2))
hold on
[A, w] = freqz(Hca);
plot(w/pi, db(A), 'r')
ylim([-80, 10])
hold off

Allpass Realization of an Elliptic Highpass Filter — Automated Design

Remove a low-frequency sinusoid using an elliptic highpass filter design implemented through a coupled allpass structure.

% Initialize
Fs = 1000;
f1 = 50; f2 = 100;
Fpass = 70; Apass = 1;
Fstop = 60; Astop = 80;
filtSpecs = fdesign.highpass(Fstop,Fpass,Astop,Apass,Fs);
hHP = design(filtSpecs,'ellip','FilterStructure','cascadeallpass',...
    'SystemObject',true);
frameLength = 1000; 
nFrames = 100;
hSR   = dsp.SineWave('Frequency',[f1,f2],'SampleRate',Fs,...
  'SamplesPerFrame',frameLength); % Input composed of two sinusoids.
hplot = dsp.SpectrumAnalyzer('SampleRate',Fs,'YLimits',[-150 30],...
  'PlotAsTwoSidedSpectrum',false,'ShowLegend',true,...
  'FrequencyResolutionMethod', 'WindowLength','WindowLength',1000,...
  'FFTLengthSource', 'Property','FFTLength', 1000,...
  'Title','Original (Channel 1) Filtered (Channel 2)');
% Simulate
for k = 1:nFrames
  original = sum(step(hSR),2); % Add the two sinusoids together
  filtered = step(hHP,original);
  step(hplot,[original,filtered]);
end

Algorithms

The following three figures summarize the main structures supported by dsp.CoupledAllpassFilter.

  • Minimum Multiplier and WDF

  • Lattice

  • Lattice with Complex Conjugate Coefficients

References

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

[2] Mitra, Sanjit K., and James F. Kaiser, "Handbook for Digital Signal Processing" New York: John Wiley & Sons, 1993.

Was this topic helpful?