Arbitrary group delay filter specification object
Arbitrary group delay filters are allpass filters that you can use to correct
the phase distortion introduced by other filters. The
fdesign.arbgrpdelay function uses an iterative least
p-th norm optimization procedure to minimize the phase response
fdesign.arbgrpdelay function returns a filter design
specification object containing filter specifications, such as filter order, number of
bands, frequency vector, and group delay response. You then use the
design function to design the filter from the filter design
allpass arbitrary group delay filter design specification object with the filter
order of 10, frequency vector of [0 0.1 1], and group delay response vector of [2 3
specObj = fdesign.arbgrpdelay
specifies the sample rate in Hz. If you specify a sample rate, the group delay
response values in the filter design specification object are in seconds. If you do
not specify a sample rate, the function normalizes all frequencies and the group
delay response values are in samples.
specObj = fdesign.arbgrpdelay(___,
Design Arbitrary Group Delay Filter
Create 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 nine periods of the sinusoid with the higher frequency that precede five periods of the signal with the lower frequency.
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 wave packet with the higher frequency by approximately 100 samples.
N = 18; f = 0:.1:1; gd = ones(size(f));
Delay /2 radians/sample by 100 samples.
gd(6) = 100; d = fdesign.arbgrpdelay(N,f,gd); Hd = design(d,'iirlpnorm',MaxPoleRadius=0.9,SystemObject=true);
Visualize the group delay.
Filter the input signal with the arbitrary group delay filter and plot 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 = 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
Design an allpass filter with an arbitrary group delay using the
fdesign.arbgrpdelay and the
design functions. Pass
iirlpnorm as the design method.
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,... SystemObject=true)
Hgd = dsp.SOSFilter with properties: Structure: 'Direct form II' CoefficientSource: 'Property' Numerator: [5x3 double] Denominator: [5x3 double] HasScaleValues: true ScaleValues: [0.2292 1 1 1 1 1.3458] Show all properties
Multiband Delay Equalization
Perform group delay equalization of a bandstop Chebyshev filter operating with a sample rate of 1 kHz.
Fs = 1e3; Hcheby2 = design(fdesign.bandstop('N,Fst1,Fst2,Ast',10,150,400,60,Fs),'cheby2',... SystemObject=true); 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 18 order 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,SystemObject=true); 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');
spec — Filter specification
'N,F,Gd' (default) |
Filter specification, specified as one of these character vectors:
This table describes the options available in each expression.
|Filter order (must be even)|
|Group delay response vector|
|Number of frequency bands|
The design methods that you can use to design the filter depend on the
specification expression. You can obtain these methods using the
designmethods function. This
table lists the specification expressions supported by the
fdesign.arbgrpdelay function and the corresponding
|Specification Expression||Supported Design Method||Filter Description|
Least P-norm optimal IIR filter
Least P-norm optimal IIR filter
To design the filter, call the
design function with one of
the design methods as an input. For more details on the procedure, see Filter Design Procedure. For an
example, see Design an Allpass Filter With an Arbitrary Group Delay.
value1,...,valueN — Specification values
comma-separated list of values
Specification values, specified as a comma-separated list of values.
Specify a value for each option in
spec in the same
order as the options in the specification expression.
The arguments below describe more details for each option in the expression.
N — Filter order
10 (default) | even positive integer
Filter order, specified as an even positive integer. The
numerator and denominator orders are both equal to
N. For more information on why the
numerator and denominator filter orders are equal and even in
fdesign.arbgrpdelay function, see Allpass Systems.
F — Frequency vector
[0 0.1 1] (default) | row vector
Frequency vector for the group delay specifications, specified as a row vector. The elements of the frequency vector must increase monotonically.
If you do not specify a sample rate
the function normalizes the frequencies. For a single-band
design, the first element of the normalized frequency vector
must be 0 and the last element must be 1. These correspond to 0
and π radians/sample, respectively. For multiband designs, the
union of the frequency vectors must range between [0, 1].
If you specify a sample rate
first element of the frequency vector in a single-band design
must be 0. The last element must be the Nyquist frequency
Fs/2. For multiband designs, the union
of the frequency vectors must range between [0,
Gd — Group delay vector
[2 3 1] (default) | row vector
Group delay vector, specified as a row vector with nonnegative
elements and equal in length to the frequency vector
F. The elements of
Gd specify the nonnegative group delay
at the corresponding element of the frequency vector
If you do not specify a sample rate
Hz, the group delay values are in samples. If you specify a
sample rate, the group delay values are in seconds.
B — Number of frequency bands
1 (default) | positive integer
Number of frequency bands, specified as a positive integer. To
use this argument, you must specify a frequency vector
F and a group delay vector
Gd for each band. The union of the
frequency vectors must range between [0, 1] in normalized
frequency or [0,
Fs/2] when you specify a
sample rate. The elements in the union of the frequency bands
must be monotonically increasing.
filtorder = 14; freqband1 = [0 0.1 0.4]; grpdelay1 = [1 2 3]; freqband2 = [0.5 0.8 1]; grpdelay2 = [3 2 1]; D = fdesign.arbgrpdelay('N,B,F,Gd',filtorder,2,freqband1,grpdelay1,freqband2,grpdelay2);
Fs — Sample rate
Sample rate, specified as a positive scalar. Specify this argument after
all the other input arguments. Specifying a sample rate forces the group
delay units to be in seconds. If you specify a sample rate, the first
element of the frequency vector must be 0 and the last element must be the
specObj — Allpass arbitrary group delay filter specification object
Allpass arbitrary group delay filter design specification object, returned
arbgrpdelay object. The object properties depend on
spec input argument.
The filter design specification object can contain one or more of these properties:
NBands–– Appears if the
Specificationproperty is set to
normalizefreq function to
NormalizedFrequency property after
constructing the specification object.
Group Delay in Discrete-Time Filter Design
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 the frequency components of the signal to disperse. You may not want this phase distortion even if the magnitude distortion introduced by the filter produces the desired effect. See Design Arbitrary Group Delay Filter 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.
This equation shows 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.
fdesign.arbgrpdelay function uses robust second-order section
(biquad) filter structures to implement the allpass arbitrary group delay filter,
the filter order must be even.
If your arbitrary group delay design produces the
Poorly conditioned Hessian
matrix error, perform one of the following or both.
MaxPoleRadiusIIR lp norm design option to a number less than 1 when you
designyour filter.For more information on the
MaxPoleRadiusdesign option, see the Design Arbitrary Group Delay Filter and Multiband Delay Equalization examples.
Reduce the order of your filter design.
fdesign.arbgrpdelay function uses a least p-th
norm iterative optimization described in .
 Antoniou, A. Digital Signal Processing: Signals, Systems, and Filters., New York:McGraw-Hill, 2006, pp. 719–771.
Introduced in R2011b