grpdelay: Group delay of a filter or model

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/grpdelay.R

Description

The group delay of a filter or model. The group delay is the time delay for a sinusoid at a given frequency.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Default S3 method:
grpdelay(filt, a = 1, n = 512, whole = FALSE, Fs = NULL, ...)

## S3 method for class 'Arma'
grpdelay(filt, ...)

## S3 method for class 'Ma'
grpdelay(filt, ...)

## S3 method for class 'Zpg'
grpdelay(filt, ...)

## S3 method for class 'grpdelay'
plot(x, xlab = if(x$HzFlag) 'Hz' else 'radian/sample', 
    ylab = 'Group delay (samples)', type = "l", ...)

## S3 method for class 'grpdelay'
print(x, ...)

Arguments

filt

for the default case, the moving-average coefficients of an ARMA model or filter. Generically, filt specifies an arbitrary model or filter operation.

a

the autoregressive (recursive) coefficients of an ARMA filter.

n

number of points at which to evaluate the frequency response.

whole

FALSE (the default) to evaluate around the upper half of the unit circle or TRUE to evaluate around the entire unit circle.

Fs

sampling frequency in Hz. If not specified, the frequencies are in radians.

x

object to be plotted.

xlab,ylab,type

as in plot, but with more sensible defaults.

...

for methods of grpdelay, arguments are passed to the default method. For plot.grpdelay, additional arguments are passed through to plot.

Details

For fastest computation, n should factor into a small number of small primes.

If the denominator of the computation becomes too small, the group delay is set to zero. (The group delay approaches infinity when there are poles or zeros very close to the unit circle in the z plane.)

When results of grpdelay are printed, the group delay will be plotted. As with lattice plots, automatic printing does not work inside loops and function calls, so explicit calls to print or plot are needed there.

Value

A list of class grpdelay with items:

gd

the group delay, in units of samples. It can be converted to seconds by multiplying by the sampling period (or dividing by the sampling rate Fs).

w

frequencies at which the group delay was calculated.

ns

number of points at which the group delay was calculated.

HzFlag

TRUE for frequencies in Hz, FALSE for frequencies in radians.

Author(s)

Original Octave version by Julius O. Smith III and Paul Kienzle. Conversion to R by Tom Short.

References

https://ccrma.stanford.edu/~jos/filters/Numerical_Computation_Group_Delay.html

https://en.wikipedia.org/wiki/Group_delay

Octave Forge https://octave.sourceforge.io/

See Also

filter, Arma, freqz

Examples

1
2
3
4
5
6
# Two Zeros and Two Poles
b <- poly(c(1/0.9*exp(1i*pi*0.2), 0.9*exp(1i*pi*0.6)))
a <- poly(c(0.9*exp(-1i*pi*0.6), 1/0.9*exp(-1i*pi*0.2)))
gpd <- grpdelay(b, a, 512, whole = TRUE, Fs = 1)
print(gpd)
plot(gpd)

Example output

Attaching package: 'signal'

The following objects are masked from 'package:stats':

    filter, poly

- Group delay (gd) calculated at 512 points.
- Frequencies (w) given in *Hz*. 
           gd           w
 1.332268e-15 0.000000000
 1.901213e-02 0.001953125
 3.810711e-02 0.003906250
 5.736863e-02 0.005859375
 .......  .......

signal documentation built on May 25, 2021, 9:06 a.m.

Related to grpdelay in signal...