# grpdelay

Group delay response of discrete-time filter

## Description

[gd,w] = grpdelay(rcfilter) returns gd, the group delay of the specified filter based on the filter coefficients. The output w contains the frequencies (in radians per sample) at which the function evaluates the group delay. The group delay is defined as$-\frac{d}{dw}\left(angle\left(w\right)\right)$.

[gd,w] = grpdelay(rcfilter,n) returns the group delay of the specified filter and the corresponding frequencies at n points that are equally spaced around the upper-half of the unit circle (from 0 to π).

[gd,w] = grpdelay(___,'Arithmetic',arithType) computes the group delay of the filter System object™, specifies the type of arithmetic that the function uses to compute the group delay. You can use any input combination from the previous syntaxes.

example

grpdelay(rcfilter) plots the group delay of the specified filter by using the fvtool object function.

For more input options, see the grpdelay function.

## Examples

collapse all

Compute the group delay of an RRC filter.

rcfilter = comm.RaisedCosineTransmitFilter;
gd = grpdelay(rcfilter,32);
gd(1:5)'
ans = 1×5

40    40    40    40    40

## Input Arguments

collapse all

Filter, specified as one of these System objects.

Number of points over which the group delay is computed, specified as a positive integer. For faster computations (performed using FFTs) specify n as a power of two.

Data Types: double

Arithmetic used in the filter analysis, specified as 'double', 'single', or 'Fixed'. When you do not specify the arithmetic type and the filter System object is unlocked, the analysis tool assumes a double-precision filter. When you do not specify the arithmetic type and the System object is locked, the function performs the analysis based on the data type of the locked input.

The 'Fixed' value applies to filter System objects with fixed-point properties only.

When you specify this input as 'Fixed' and the filter object has the data type of the coefficients set to 'Same word length as input', the arithmetic analysis performed depends on whether the System object is unlocked or locked.

• If the System object is unlocked, the analysis object function cannot determine the data type of the coefficients. The function assumes that the data type of the coefficients is signed, has a 16-bit word length, and is autoscaled. The function performs fixed-point analysis based on this assumption.

• If the System object is locked –– When the input data type is 'double' or 'single', the analysis object function cannot determine the data type of the coefficients. The function assumes that the data type of the coefficients is signed, has a 16-bit word length, and is autoscaled. The function performs fixed-point analysis based on this assumption.

To check if the System object is locked or unlocked, use the isLocked function.

When you specify this input as 'Fixed' and the filter object has the data type of the coefficients set to a custom numeric type, the object function performs fixed-point analysis based on the custom numeric data type.

Data Types: char | string

## Output Arguments

collapse all

Group delay, returned as a column vector of length n.

Data Types: double

Frequencies in radians/sample used for group delay evaluation, returned as a column vector of length n. Unit are in radians per sample. The frequencies are equally spaced around the upper-half of the unit circle (from 0 to π).

Data Types: double

## Tips

• For faster computations (performed using FFTs), specify n, the number of points over which the function computes the group delay, as a power of two.

## Version History

Introduced in R2013b