| Signal Processing Toolbox | Search  Help Desk |
| grpdelay | Examples See Also |
Average filter delay (group delay).
Syntax
[gd,w] = grpdelay(b,a,n) [gd,f] = grpdelay(b,a,n,Fs) [gd,w] = grpdelay(b,a,n,'whole') [gd,f] = grpdelay(b,a,n,'whole',Fs) gd = grpdelay(b,a,w) gd = grpdelay(b,a,f,Fs) grpdelay(b,a)
Description
The group delay of a filter is a measure of the average delay of the filter as a function of frequency. It is the negative first derivative of the phase response of the filter. If the complex frequency response of a filter is H(ej
), then the group delay is
is frequency and
is the phase angle of H(ej
).
[gd,w] = grpdelay(b,a,n)
returns the n-point group delay,
, of the digital filter
b and a. grpdelay returns both gd, the group delay, and w, a vector containing the n frequency points in radians. grpdelay evaluates the group delay at n points equally spaced around the upper half of the unit circle, so w contains n points between 0 and
. A value for n that is an exact power of two allows fast computation using an FFT algorithm.
[gd,f] = grpdelay(b,a,n,Fs)
specifies a positive sampling frequency Fs in Hertz. It returns a length n vector f containing the actual frequency points at which the group delay is calculated, also in Hertz. f contains n points between 0 and Fs/2.
[gd,w] = grpdelay(b,a,n,'whole')
and
[gd,f] = grpdelay(b,a,n,'whole',Fs)
use n points around the whole unit circle (from 0 to 2
, or from 0 to Fs).
gd = grpdelay(b,a,w)
and
gd = grpdelay(b,a,f,Fs)
return the group delay evaluated at the points in w (in radians) or f (in Hertz), respectively, where Fs is the sampling frequency in Hertz.
grpdelay
with no output arguments plots the group delay versus frequency in the current figure window.
grpdelay works for both real and complex input systems.
Examples
Plot the group delay of Butterworth filter b(z)/a(z):[b,a] = butter(6,0.2); grpdelay(b,a,128)Plot both the group and phase delays of a system on the same graph:
![]()
gd = grpdelay(b,a,512);
gd(1) = []; % avoid NaNs
[h,w] = freqz(b,a,512); h(1) = []; w(1) = [];
pd = -unwrap(angle(h))./w;
plot(w,gd,w,pd,':')
xlabel('Frequency (rads/sec)'); grid;
legend('Group Delay','Phase Delay');
Algorithm
grpdelay multiplies the filter coefficients by a unit ramp. After Fourier transformation, this process corresponds to differentiation.
See Also
cceps |
Complex cepstral analysis. |
fft |
One-dimensional fast Fourier transform. |
freqz |
Frequency response of digital filters. |
hilbert |
Hilbert transform. |
icceps |
Inverse complex cepstrum. |
rceps |
Real cepstrum and minimum phase reconstruction. |