Documentation

iirgrpdelay

Optimal IIR filter with prescribed group-delay

Syntax

[num,den] = iirgrpdelay(n,f,edges,a)
[num,den] = iirgrpdelay(n,f,edges,a,w)
[num,den,tau] = iirgrpdelay(n,f,edges,a,w)

Description

[num,den] = iirgrpdelay(n,f,edges,a) returns an allpass IIR filter of order n (n must be even) which is the best approximation to the relative group-delay response described by f and a in the least-pth sense. f is a vector of frequencies between 0 and 1 and a is specified in samples. The vector edges specifies the band-edge frequencies for multi-band designs. iirgrpdelay uses a constrained Newton-type algorithm. Always check your resulting filter using grpdelay or freqz.

[num,den] = iirgrpdelay(n,f,edges,a,w) uses the weights in w to weight the error. w has one entry per frequency point and must be the same length as f and a). Entries in w tell iirgrpdelay how much emphasis to put on minimizing the error in the vicinity of each specified frequency point relative to the other points.

f and a must have the same number of elements. f and a can contains more elements than the vector edges contains. This lets you use f and a to specify a filter that has any group-delay contour within each band.

[num,den] = iirgrpdelay(n,f,edges,a,w,radius) returns a filter having a maximum pole radius equal to radius, where 0<radius<1. radius defaults to 0.999999. Filters whose pole radius you constrain to be less than 1.0 can better retain transfer function accuracy after quantization.

[num,den] = iirgrpdelay(n,f,edges,a,w,radius,p), where p is a two-element vector [pmin pmax], lets you determine the minimum and maximum values of p used in the least-pth algorithm. p defaults to [2 128] which yields filters very similar to the L-infinity, or Chebyshev, norm. pmin and pmax should be even. If p is 'inspect', no optimization occurs. You might use this feature to inspect the initial pole/zero placement.

[num,den] = iirgrpdelay(n,f,edges,a,w,radius,p,dens) specifies the grid density dens used in the optimization process. The number of grid points is (dens*(n+1)). The default is 20. dens can be specified as a single-element cell array. The grid is not equally spaced.

[num,den] = iirgrpdelay(n,f,edges,a,w,radius,p,dens,initden) allows you to specify the initial estimate of the denominator coefficients in vector initden. This can be useful for difficult optimization problems. The pole-zero editor in Signal Processing Toolbox™ software can be used for generating initden.

[num,den] = iirgrpdelay(n,f,edges,a,w,radius,p,dens,initden,tau) allows the initial estimate of the group delay offset to be specified by the value of tau, in samples.

[num,den,tau] = iirgrpdelay(n,f,edges,a,w) returns the resulting group delay offset. In all cases, the resulting filter has a group delay that approximates [a + tau]. Allpass filters can have only positive group delay and a non-zero value of tau accounts for any additional group delay that is needed to meet the shape of the contour specified by (f,a). The default for tau is max(a).

Hint: If the zeros or poles cluster together, your filter order may be too low or the pole radius may be too small (overly constrained). Try increasing n or radius.

For group-delay equalization of an IIR filter, compute a by subtracting the filter's group delay from its maximum group delay. For example,

[be,ae] = ellip(4,1,40,0.2);
f = 0:0.001:0.2;
g = grpdelay(be,ae,f,2);   % Equalize only the passband.
a = max(g)-g;
[num,den]=iirgrpdelay(8, f, [0 0.2], a);

References

Antoniou, A., Digital Filters: Analysis, Design, and Applications, Second Edition, McGraw-Hill, Inc. 1993.