[gd,w] = grpdelay(b,a,n)
returns the n-point group delay response vector,
gd, and the corresponding angular frequency vector,
w, for the digital filter with transfer function coefficients
stored in b and a.
[gd,w] = grpdelay(d,n)
returns the n-point group delay response for the digital filter
d.
[gd,w] = grpdelay(___,'whole')
returns the group delay at n sample points around the entire unit
circle.
[gd,f] = grpdelay(___,n,fs)
returns the group delay response vector gd and the corresponding
physical frequency vector f for a digital filter designed to filter
signals sampled at a rate fs.
[gd,f] = grpdelay(___,n,'whole',fs)
returns the frequency vector at n points ranging between 0 and
fs.
gd = grpdelay(___,win)
returns the group delay response vector gd evaluated at the
normalized frequencies supplied in win.
Design an 88th-order FIR filter of arbitrary magnitude response. The filter has two passbands and two stopbands. The lower-frequency passband has twice the gain of the higher-frequency passband. Specify a sample rate of 200 Hz. Visualize the magnitude response and the phase response of the filter from 10 Hz to 78 Hz.
Transfer function coefficients, specified as vectors. Express the transfer function in
terms of b and a as
Example: b = [1 3 3 1]/6 and a = [3 0 1 0]/3
specify a third-order Butterworth filter with normalized 3 dB frequency 0.5π
rad/sample.
Data Types: double | single Complex Number Support: Yes
n — Number of evaluation points 512 (default) | positive integer scalar
Number of evaluation points, specified as a positive integer
scalar no less than 2. When n is absent, it defaults
to 512. For best results, set n to a value greater
than the filter order.
Data Types: double
sos — Second-order section coefficients matrix
Second-order section coefficients, specified as a matrix. 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, the function treats the input as a numerator vector. Each row of
sos corresponds to the coefficients of a second-order (biquad)
filter. The ith row of sos corresponds to
[bi(1) bi(2) bi(3) ai(1) ai(2) ai(3)].
Example: s = [2 4 2 6 0 2;3 3 0 6 0 0] specifies a third-order Butterworth
filter with normalized 3 dB frequency 0.5π rad/sample.
Data Types: double | single Complex Number Support: Yes
d — Digital filter digitalFilter object
Digital filter, specified as a digitalFilter object. Use designfilt to generate a digital filter
based on frequency-response specifications.
Example: d =
designfilt('lowpassiir','FilterOrder',3,'HalfPowerFrequency',0.5)
specifies a third-order Butterworth filter with normalized 3 dB frequency 0.5π
rad/sample.
fs — Sample rate positive scalar
Sample rate, specified as a positive scalar. When the unit of time is seconds,
fs is expressed in hertz.
Data Types: double
win — Angular frequencies vector
Angular frequencies, specified as a vector and expressed in rad/sample.
win must have at least two elements, because otherwise the
function interprets it as n. win = π corresponds to the Nyquist frequency.
fin — Frequencies vector
Frequencies, specified as a vector. fin must have at least two
elements, because otherwise the function interprets it as n. When
the unit of time is seconds, fin is expressed in hertz.
Group delay response, returned as a vector. If you specify n,
then gd has length n. If you do not specify
n, or specify n as the empty vector, then
gd has length 512.
If the input to grpdelay is single precision, the function
computes the group delay using single-precision arithmetic. The output
h is single precision.
w — Angular frequencies vector
Angular frequencies, returned as a vector. w has values ranging
from 0 to π. If you specify 'whole' in your input,
the values in w range from 0 to 2π. If you
specify n, w has length
n. If you do not specify n, or specify
n as the empty vector, then w has length
512.
f — Frequencies vector
Frequencies, returned as a vector expressed in hertz. f has
values ranging from 0 to fs/2 Hz. If you specify
'whole' in your input, the values in f range
from 0 to fs Hz. If you specify n,
f has length n. If you do not specify
n, or specify n as the empty vector, then
f has length 512.
The group delay response 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 frequency response of a filter is H(ejω), then the group delay is