Arbitrary group delay filter specification object
D = fdesign.arbgrpdelay(SPEC)
D = fdesign.arbgrpdelay(SPEC,SPEC1,SPEC2,...)
D = fdesign.arbgrpdelay(N,F,Gd)
D = fdesign.arbgrpdelay(...,Fs)
Arbitrary group delay filters are allpass filters you can use for correcting phase distortion introduced by other filters. fdesign.arbgrpdelay uses an iterative least p-th norm optimization procedure to minimize the phase response error .
D = fdesign.arbgrpdelay(SPEC,SPEC1,SPEC2,...) initializes the allpass arbitrary group delay filter specification object with specifications SPEC1,SPEC2,.... See SPEC for a description of supported specifications.
D = fdesign.arbgrpdelay(N,F,Gd) specifies an allpass arbitrary group delay filter. The filter order is equal to N, frequency vector equal to F, and group delay vector equal to Gd. See SPEC for a description of the filter order, frequency vector, and group delay vector inputs. See the example Allpass Filter with Arbitrary Group Delay for an example using this syntax.
D = fdesign.arbgrpdelay(...,Fs) specifies the sampling frequency in hertz as a trailing scalar. If you do not specify a sampling frequency, all frequencies are normalized frequencies and group delay values are in samples. If you specify a sampling frequency, group delay values are in seconds.
If your arbitrary group delay design produces the error Poorly conditioned Hessian matrix, attempt one or more of the following:
Set the MaxPoleRadius IIR lp norm design option to some number less than 1. Set this option when you design your filter with the syntax:
Reduce the order of your filter design.
Specification string. SPEC is one of the following two strings. The entries are not case sensitive.
The string entries are defined as follows:
Sampling frequency. Specify the sampling frequency as a trailing positive scalar after all other input arguments. Specifying a sampling frequency forces the group delay units to be in seconds. If you specify a sampling frequency, the first element of the frequency vector must be 0. The last element must be the Nyquist frequency, Fs/2.
Filter specification object. An allpass arbitrary group delay filter specification object containing the following modifiable properties: Specification, NormalizedFrequency, FilterOrder, Frequencies, and GroupDelay.
Use the normalizefreq method to change the NormalizedFrequency property after construction.
Construct a signal consisting of two discrete-time windowed sinusoids (wave packets) with disjoint time support to illustrate frequency dispersion. One discrete-time sinusoid has a frequency of π/2 radians/sample and the other has a frequency of π/4 radians/sample. There are 9 periods of the higher–frequency sinusoid that precede 5 periods of the lower–frequency signal.
Create the signal.
x = zeros(300,1); x(1:36) = cos(pi/2*(0:35)).*hamming(36)'; x(40:40+39) = cos(pi/4*(0:39)).*hamming(40)';
Create an arbitrary group delay filter that delays the higher–frequency wave packet by approximately 100 samples.
N = 18; f = 0:.1:1; gd = ones(size(f)); % Delay pi/2 radians/sample by 100 samples gd(6) = 100; d = fdesign.arbgrpdelay(N,f,gd); Hd = design(d,'iirlpnorm','MaxPoleRadius',0.9); % Visualize the group delay fvtool(Hd,'analysis','grpdelay');
Filter the input signal with the arbitrary group delay filter and illustrate the frequency dispersion. The high–frequency wave packet, which initially preceded the low–frequency wave packet, now occurs later because of the nonconstant group delay.
y = filter(Hd,x); subplot(211) plot(x); title('Input Signal'); grid on; ylabel('Amplitude'); subplot(212); plot(y); title('Output Signal'); grid on; xlabel('Samples'); ylabel('Amplitude');
Design an allpass filter with an arbitrary group delay.
N = 10; f = [0 0.02 0.04 0.06 0.08 0.1 0.25 0.5 0.75 1]; g = [5 5 5 5 5 5 4 3 2 1]; w = [2 2 2 2 2 2 1 1 1 1]; hgd = fdesign.arbgrpdelay(N,f,g); Hgd = design(hgd,'iirlpnorm','Weights',w,'MaxPoleRadius',0.95); fvtool(Hgd,'Analysis','grpdelay') ;
Perform multiband delay equalization outside the stopband.
Fs = 1e3; Hcheby2 = design(fdesign.bandstop('N,Fst1,Fst2,Ast',10,150,400,60,Fs),'cheby2'); f1 = 0.0:0.5:150; % Hz g1 = grpdelay(Hcheby2,f1,Fs).'/Fs; % seconds f2 = 400:0.5:500; % Hz g2 = grpdelay(Hcheby2,f2,Fs).'/Fs; % seconds maxg = max([g1 g2]); % Design an arbitrary group delay allpass filter to equalize the group % delay of the bandstop filter. Use an order 18 multiband design and specify % two bands. hgd = fdesign.arbgrpdelay('N,B,F,Gd',18,2,f1,maxg-g1,f2,maxg-g2,Fs); Hgd = design(hgd,'iirlpnorm','MaxPoleRadius',0.95); Hcascade = cascade(Hcheby2,Hgd); hft = fvtool(Hcheby2,Hgd,Hcascade,'Analysis','grpdelay','Fs',Fs); legend(hft,'Original Bandstop Filter','Allpass Arbitrary Group Delay Filter',... 'Delay Equalization', 'Location','North');
iirgrpdelay — Returns an allpass arbitrary group delay filter. The iirgrpdelay function returns the numerator and denominator coefficients. This behavior differs from that of fdesign.arbgrpdelay, which returns the filter in second-order sections. iirgrpdelay accepts only normalized frequencies.
The frequency response of a rational discrete-time filter is:
The argument of the frequency response as a function of the angle, ω, is referred to as the phase response.
The negative of the first derivative of the argument with respect to ω is the group delay.
Systems with nonlinear phase responses have nonconstant group delay, which causes dispersion of the frequency components of the signal. You may not want this phase distortion even if the magnitude distortion introduced by the filter produces the desired effect. See Frequency Dispersion for an illustration of frequency dispersion resulting from nonconstant group delay.
In these cases, you can cascade the frequency-selective filter with an allpass filter that compensates for the group delay. This process is often referred to as delay equalization.
The general form of an allpass system function with a real-valued impulse response is:
where the dk denote the real-valued poles and the ck denote the complex-valued poles, which occur in conjugate pairs.
The preceding equation demonstrates that allpass systems with real-valued impulse responses have 2N+M zeros and poles. The poles and zeros occur in pairs with reciprocal magnitudes. The filter order is always the same for the numerator and denominator.
Because fdesign.arbgrpdelay uses robust second-order section (biquad) filter structures to implement the allpass arbitrary group delay filter, the filter order must be even.
 Antoniou, A. Digital Signal Processing: Signals, Systems, and Filters., New York:McGraw-Hill, 2006, pp. 719–771.