Zero-phase response of digital filter
returns the zero-phase response
w] = zerophase(
Hr and the angular frequencies
w at which the zero-phase response is computed, given a filter
defined by numerator coefficients
b and denominator coefficients
a. The function evaluates the zero-phase response at
512 equally spaced points on the upper half of the unit
zerophase(___) plots the
zero-phase response versus frequency. If you input the filter coefficients or second order
sections matrix, the function plots in the current figure window. If you input a
digitalFilter, the function displays the step response in FVTool.
If the input to
zerophase is single precision, the function
calculates the zero-phase response using single-precision arithmetic. The output
Hr is single precision.
Zero-Phase Response of FIR Filter
designfilt to design a 54th-order FIR filter with a normalized cutoff frequency of 0.3π rad/sample, a passband ripple of 0.7 dB, and a stopband attenuation of 42 dB. Use the method of constrained least squares. Display the zero-phase response.
Nf = 54; Fc = 0.3; Ap = 0.7; As = 42; d = designfilt("lowpassfir",FilterOrder=Nf,CutoffFrequency=Fc, ... PassbandRipple=Ap,StopbandAttenuation=As,DesignMethod="cls"); zerophase(d)
Design the same filter using
fircls1, which uses linear units to measure the ripple and attenuation. Display the zero-phase response.
pAp = 10^(Ap/40); Apl = (pAp-1)/(pAp+1); pAs = 10^(As/20); Asl = 1/pAs; b = fircls1(Nf,Fc,Apl,Asl); zerophase(b)
Zero-Phase Response of Elliptic Filter
Design a 10th-order elliptic lowpass IIR filter with a normalized passband frequency of 0.4π rad/sample, a passband ripple of 0.5 dB, and a stopband attenuation of 20 dB. Display the zero-phase response of the filter on 512 frequency points around the whole unit circle.
d = designfilt("lowpassiir",FilterOrder=10,PassbandFrequency=0.4, ... PassbandRipple=0.5,StopbandAttenuation=20,DesignMethod="ellip"); zerophase(d,512,"whole")
Create the same filter using
ellip. Plot its zero-phase response.
[b,a] = ellip(10,0.5,20,0.4); zerophase(b,a,512,"whole")
a — Filter coefficients
Filter coefficients, specified as vectors. For FIR filters where
a=1, you can omit the value
a from the
sos — Second order sections
Second order sections, specified as 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 considers the input to be the numerator
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)].
nfft — Number of frequency points
512 (default) | positive integer scalar
Number of frequency points used to compute the zero-phase response, specified as a
positive integer scalar. For best results, set
nfft to a value
greater than the filter order.
w — Angular frequencies
Angular frequencies at which the zero-phase response is computed, specified as a
vector and expressed in radians/sample.
w must have at least two
f — Frequencies
Frequencies at which the zero-phase response is computed, specified as a vector and
expressed in hertz.
f must have at least two elements.
fs — Sample rate
Sample rate, specified as a positive scalar.
Hr — Zero-phase response
Zero-phase response, returned as a vector.
The zero-phase response, Hr(ω), is related to the frequency response, H(ejω), by
where φ(ω) is the continuous phase.
The zero-phase response is always real, but it is not the equivalent of the magnitude response. The former can be negative while the latter cannot be negative.
w — Angular frequencies
Angular frequencies at which the zero-phase response is computed, returned as a vector.
f — Frequencies
Frequencies at which the zero-phase response is computed, returned as a vector.
phi — Continuous phase component
Continuous phase component, returned as a vector. This quantity is not equivalent to the phase response of the filter when the zero-phase response is negative.
 Antoniou, Andreas. Digital Filters. New York: McGraw-Hill, Inc., 1993.