# iirgrpdelay (Digital Filter Design Toolkit, MathScript Function)

Owning Class: singlerate

## Syntax

[b, a] = iirgrpdelay(n, f, e, grd)

[b, a] = iirgrpdelay(n, f, e, grd, w)

[b, a] = iirgrpdelay(n, f, e, grd, w, r)

[b, a, offset] = iirgrpdelay(n, f, e, grd)

[b, a, offset] = iirgrpdelay(n, f, e, grd, w)

[b, a, offset] = iirgrpdelay(n, f, e, grd, w, r)

## Description

Designs an allpass, infinite impulse response (IIR) filter that approximates the group delay you specify.

Examples

## Inputs

 Name Description n Specifies the order of the filter. n is an even, positive integer. f Specifies the frequency points. f is a vector whose values increase monotonically between 0 and 1. e Specifies the band edge frequencies. e is a vector whose values must also exist in f. grd Specifies the group delay at f. grd is a vector of the same length as f. w Specifies the weight of each frequency point. w is a vector of the same length as f. The default is a vector in which each element has a value of 1. r Specifies the maximum value of the radius of any filter pole. r is a double-precision, floating-point number that must fall in the range (0, 1). The default is 0.9999.

## Outputs

 Name Description b Returns the numerator of the designed IIR filter. b is a real vector with a length of n+1. a Returns the denominator of the designed IIR filter. a is a real vector with a length of n+1. offset Returns the group delay offset, which is the difference between the specified group delay and the approximated group delay. offset is a double-precision, floating-point number greater than zero.

## Examples

[b, a] = iirgrpdelay(10, [0, 0.4], [0, 0.4], [9, 0]);figure;
grpdelay(b, a);

[b0, a0] = ellip(7, 0.1, 60, 0.5);
f = [0:0.4/256:0.4];
grd0 = grpdelay(b0, a0, f*pi);
[b, a] = iirgrpdelay(6, f, [0, 0.4], max(grd0)-grd0);
comp_b = conv(b, b0);
comp_a = conv(a, a0);
figure;
grpdelay(b0, a0);
figure;
grpdelay(comp_b, comp_a);