# GRPDELAY

## Purpose:

Calculates the group delay of a Z-transform.

## Syntax:

GRPDELAY(b, a, N, Fs, whole)

b

-

A series. The numerator (i.e. zero) coefficients in ascending powers of z-1.

a

-

A series. The denominator (i.e. pole) coefficients in ascending powers of z-1.

N

-

Optional. An integer, the number of output samples, defaults to 2048.

Fs

-

Optional. A real, the sample rate of data. If the rates of the numerator and denominator coefficients are equal, the rate defaults to the coefficient rate, else the rate defaults to 1.0.

whole

-

Optional. An integer or string, the evaluation contour. Valid inputs are:

 0: evaluate the transform only over the upper half of the unit circle (default) 1: evaluate the transform over the entire unit circle

If whole is a string, the transform is evaluated over the entire unit circle.

## Alternate Syntax:

GRPDELAY(c, N, Fs, whole)

c

-

A series. The system coefficients in cascaded bi-quad form. If c contains 2 columns, the coefficients are assumed to be in direct form, where the first column is b and the second column is a.

N

-

Optional. An integer, the number of output samples, defaults to 2048.

Fs

-

Optional. A real, the sample rate of data. Defaults to the rate of the coefficients.

whole

-

Optional. An integer or string, the evaluation contour. Valid inputs are:

 0: evaluate the transform only over the upper half of the unit circle (default) 1: evaluate the transform over the entire unit circle

If whole is a string, the transform is evaluated over the entire unit circle.

## Returns:

A series, the group delay in samples.

## Example: W1: grpdelay({1}, {1, -0.5})

returns 512 samples of the group delay in W1.

## Example:

W1: butterworth(1, 100.0, 10.0)

W2: grpdelay(w1, 1024)

creates a 10 Hz low pass BUTTERWORTH filter. W2 calculates and displays 1024 samples of the group delay response of the filter

## Remarks:

The group delay is defined as: Where phase(f) is the unwrapped phase response of the filter. To avoid difficulties in determining the unwrapped phase, the derivative is calculated by the following equivalent FFT expression: where t is the time index series and h(t) is the impulse response of the filter.

GRPDELAY uses the above method evaluate N uniformly spaced samples of the group delay over the unit circle of a Z-transform in direct form: z = e jω complex frequency N = number of numerator terms M = number of denominator terms

For grpdelay(c, N, Fs, whole), the input c is assumed to be a single column of coefficients in cascaded bi-quad form. This is the output format of IIR filters designed by DADiSP/Filters and processed by the CASCADE function. or equivalently: where G is the system gain, bk and ak are the filter coefficients for the kth stage.

If c contains 2 columns, the coefficients are assumed to be in direct form, where the first column is b and the second column is a.

The amplitude of the group delay is in samples.

See IMPZ to display the impulse response of a Z-transform.

See ZFREQ to calculate the magnitude or phase response of a Z-transform.

FFT

FILTEQ

IMPZ

INVFREQZ

MAGNITUDE

PHASE

RESIDUEZ

ZFREQ