You are here : matlabSignal Processinggrpdelay

grpdelay() - Signal Processing

[gd,w] = grpdelay(b,a)  returns
the group delay response, gd, of the discrete-time
filter specified by the input vectors, b and a.
The input vectors are the coefficients for the numerator, b,
and denominator, a, polynomials in z-1.
The Z-transform of the discrete-time filter isH(z)=B(z)A(z)=∑l=0N−1b(n+1)z−l∑l=0M−1a(l+1)z−l,The filter's group delay response is evaluated at 512
equally spaced points in the interval [0,π)
on the unit circle. The evaluation points on the unit circle are returned
in w.[gd,w] = grpdelay(b,a,n) returns the group
delay response of the discrete-time filter evaluated at n equally
spaced points on the unit circle in the interval [0,π). n is
a positive integer. For best results, set n to
a value greater than the filter order.[gd,w] = grpdelay(sos,n) returns the group
delay response for the second-order sections matrix, sos. sos is
a K-by-6 matrix, where the number of sections, K,
must be greater than or equal to 2. If the number of sections is less
than 2, grpdelay considers the input to be the
numerator vector, b. Each row of sos corresponds
to the coefficients of a second-order (biquad) filter. The ith
row of the sos matrix corresponds to [bi(1)
bi(2) bi(3) ai(1) ai(2) ai(3)].[gd,w] = grpdelay(d,n) returns the group
delay response for the digital filter, d. Use designfilt to generate d based
on frequency-response specifications.[gd,f] = grpdelay(...,n,fs) specifies a positive
sampling frequency fs in hertz. It returns a length-n vector, f,
containing the frequency points in hertz at which the group delay
response is evaluated. f contains n points
between 0 and fs/2.[gd,w] = grpdelay(...,n,'whole') and [gd,f] = grpdelay(...,n,'whole',fs) use n points
around the whole unit circle (from 0 to 2π,
or from 0 to fs).gd = grpdelay(...,w) and gd = grpdelay(...,f,fs) return
the group delay response evaluated at the angular frequencies in w (in
radians/sample) or in f (in cycles/unit time),
respectively, where fs is the sampling frequency. w and f are
vectors with at least two elements.grpdelay(...) with no output
arguments plots the group delay response versus frequency.grpdelay works for both real and complex
filters.Note:  


If the input to grpdelay is single precision,
the group delay is calculated using single-precision arithmetic. The
output, gd, is single precision.


Syntax

[gd,w] = grpdelay(b,a) [gd,w] = grpdelay(b,a,n)[gd,w] = grpdelay(sos,n)[gd,w] = grpdelay(d,n)[gd,f] = grpdelay(...,n,fs)[gd,w] = grpdelay(...,n,'whole')[gd,f] = grpdelay(...,n,'whole',fs)gd = grpdelay(...,w)gd = grpdelay(...,f,fs)grpdelay(...)


Example

Group Delay of a Butterworth FilterOpen This Example
Design a Butterworth filter of order 6 with normalized 3-dB frequency 
 rad/sample. Use grpdelay to display the group delay.
[z,p,k] = butter(6,0.2);
sos = zp2sos(z,p,k);
grpdelay(sos,128)

Plot both the group delay and the phase delay of the system on the same figure.gd = grpdelay(sos,512);
[h,w] = freqz(sos,512);
pd = -unwrap(angle(h))./w;
plot(w/pi,gd,w/pi,pd), grid
xlabel 'Normalized Frequency (\times\pi rad/sample)'
ylabel 'Group and phase delays'
legend('Group delay','Phase delay')

Group Delay Response of a Butterworth digitalFilterOpen This Example
Use designfilt to design a sixth-order Butterworth Filter with normalized 3-dB frequency 
 rad/sample. Display its group delay response.
d = designfilt('lowpassiir','FilterOrder',6, ...
    'HalfPowerFrequency',0.2,'DesignMethod','butter');
grpdelay(d)


Output / Return Value


Limitations


Alternatives / See Also


Reference