Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

grpdelay

Group delay


Description

Compute the average delay of a filter (group delay).

Usage

grpdelay(filt, ...)

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

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

## 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 'Sos'
grpdelay(filt, ...)

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

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.

...

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

x

object to be plotted.

xlab, ylab, type

as in plot, but with more sensible defaults.

a

the autoregressive (recursive) coefficients of an ARMA filter.

n

number of points at which to evaluate the frequency response. If n is a vector with a length greater than 1, then evaluate the frequency response at these points. For fastest computation, n should factor into a small number of small primes. Default: 512.

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.

Details

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.)

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)

Paul Kienzle, pkienzle@users.sf.net,
Julius O. Smith III, jos@ccrma.stanford.edu.
Conversion to R by Tom Short,
adapted by Geert van Boxtel, gjmvanboxtel@gmail.com

References

Examples

# 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)

gsignal

Signal Processing

v0.3-1
GPL-3
Authors
Geert van Boxtel [aut, cre] (Maintainer), Tom Short [aut] (Author of 'signal' package), Paul Kienzle [aut] (Majority of the original sources), Ben Abbott [ctb], Juan Aguado [ctb], Muthiah Annamalai [ctb], Leonardo Araujo [ctb], William Asquith [ctb], David Bateman [ctb], David Billinghurst [ctb], Juan Pablo Carbajal [ctb], André Carezia [ctb], Vincent Cautaerts [ctb], Eric Chassande-Mottin [ctb], Luca Citi [ctb], Dave Cogdell [ctb], Carlo de Falco [ctb], Carne Draug [ctb], Pascal Dupuis [ctb], John W. Eaton [ctb], R.G.H Eschauzier [ctb], Andrew Fitting [ctb], Alan J. Greenberger [ctb], Mike Gross [ctb], Daniel Gunyan [ctb], Kai Habel [ctb], Kurt Hornik [ctb], Jake Janovetz [ctb], Alexander Klein [ctb], Peter V. Lanspeary [ctb], Bill Lash [ctb], Friedrich Leissh [ctb], Laurent S. Mazet [ctb], Mike Miller [ctb], Petr Mikulik [ctb], Paolo Neis [ctb], Georgios Ouzounis [ctb], Sylvain Pelissier [ctb], Francesco Potortì [ctb], Charles Praplan [ctb], Lukas F. Reichlin [ctb], Tony Richardson [ctb], Asbjorn Sabo [ctb], Thomas Sailer [ctb], Rolf Schirmacher [ctb], Rolf Schirmacher [ctb], Ivan Selesnick [ctb], Julius O. Smith III [ctb], Peter L. Soendergaard [ctb], Quentin Spencer [ctb], Doug Stewart [ctb], P. Sudeepam [ctb], Stefan van der Walt [ctb], Andreas Weber [ctb], P. Sudeepam [ctb], Andreas Weingessel [ctb]
Initial release
2021-05-02

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.