Documentation |
Package: dsp
Coupled allpass IIR filter
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:
Define and set up your Coupled Allpass Filter. See Construction.
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.
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.
clone | Create Coupled Allpass Filter System object with same property values |
getBranches | Return internal allpass branches |
isLocked | Locked status for input attributes and nontunable properties |
release | Allow property value and input characteristics changes |
reset | Reset internal states of Coupled Allpass filter |
step | Filter input with CoupledAllpas filter object |
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
The following three figures summarize the main structures supported by dsp.CoupledAllpassFilter.
Minimum Multiplier and WDF
Lattice
Lattice with Complex Conjugate Coefficients
[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.