You are here : matlabSignal Processingphasez

phasez() - Signal Processing

[phi,w] = phasez(b,a,n) returns
the n-point unwrapped phase response vector, phi,
in radians and the frequency vector, w, in radians/sample
for the filter coefficients specified in b and a.
The values of the frequency vector, w, range from
0 to π. If n is omitted,
the length of the phase response vector defaults to 512. For best
results, set n to a value greater than the filter
order.[phi,w] = phasez(sos,n) returns the unwrapped
phase 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, phasez 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)].[phi,w] = phasez(d,n) returns the unwrapped
phase response for the digital filter, d. Use designfilt to generate d based
on frequency-response specifications.[phi,w] = phasez(...,n,'whole') returns
frequency and unwrapped phase response vectors evaluated at n equally-spaced
points around the unit circle from 0 to 2π radians/sample.phi = phasez(...,w) returns
the unwrapped phase response in radians at frequencies specified in w (radians/sample).
The frequencies are normally between 0 and π.
The vector w must have at least two elements.[phi,f] = phasez(...,n,fs) return
the unwrapped phase vector phi in radians and the
frequency vector in hertz. The frequency vector ranges from 0 to the
Nyquist frequency, fs/2. If the 'whole' option
is used, the frequency vector ranges from 0 to the sampling frequency.phi = phasez(...f,fs) return
the phase response in radians at the frequencies specified in the
vector f (in hertz) using the sampling frequency fs (in
hertz). The vector f must have at least two elements.[phi,w,s] = phasez(...) return
plotting information, where s is a structure array
with fields you can change to display different frequency response
plots.phasez(...) with no output
arguments plots the phase response of the filter. If you input the
filter coefficients or second order sections matrix, the current figure
window is used. If you input a digitalFilter, the step response is displayed in fvtool.Note:  


If the input to phasez is single precision,
the phase response is calculated using single-precision arithmetic.
The output, phi, is single precision.


Syntax

[phi,w] = phasez(b,a,n)[phi,w] = phasez(sos,n)[phi,w] = phasez(d,n)[phi,w] = phasez(...,n,'whole')phi = phasez(...,w)[phi,f] = phasez(...,n,fs)phi = phasez(...f,fs)[phi,w,s] = phasez(...)phasez(...)


Example

Phase Response of an FIR FilterOpen This Example
Use designfilt to design an FIR filter of order 54, normalized cutoff frequency 
 rad/s, passband ripple 0.7 dB, and stopband attenuation 42 dB. Use the method of constrained least squares. Display the phase response of the filter.
Nf = 54;
Fc = 0.3;
Ap = 0.7;
As = 42;

d = designfilt('lowpassfir','CutoffFrequency',Fc,'FilterOrder',Nf, ...
               'PassbandRipple',Ap,'StopbandAttenuation',As, ...
               'DesignMethod','cls');
phasez(d)

Design the same filter using fircls1. Keep in mind that fircls1 uses linear units to measure the ripple and attenuation.pAp = 10^(Ap/40);
Apl = (pAp-1)/(pAp+1);

pAs = 10^(As/20);
Asl = 1/pAs;

b = fircls1(Nf,Fc,Apl,Asl);
phasez(b)

Phase Response of an Equiripple FilterOpen This Example
Design a lowpass equiripple filter with normalized passband frequency 
 rad/s, normalized stopband frequency 
 rad/s, passband ripple 1 dB, and stopband attenuation 60 dB. Display the phase response of the filter.
d = designfilt('lowpassfir', ...
               'PassbandFrequency',0.45,'StopbandFrequency',0.55, ...
               'PassbandRipple',1,'StopbandAttenuation',60, ...
               'DesignMethod','equiripple');
phasez(d)

Phase Response of an Elliptic FilterOpen This Example
Design an elliptic lowpass IIR filter with normalized passband frequency 
 rad/s, normalized stopband frequency 
 rad/s, passband ripple 1 dB, and stopband attenuation 60 dB. Display the phase response of the filter.
d = designfilt('lowpassiir', ...
               'PassbandFrequency',0.4,'StopbandFrequency',0.5, ...
               'PassbandRipple',1,'StopbandAttenuation',60, ...
               'DesignMethod','ellip');
phasez(d)


Output / Return Value


Limitations


Alternatives / See Also


Reference