Main Content

Phase Response

MATLAB® functions are available to extract the phase response of a filter. Given a frequency response, the function abs returns the magnitude and angle returns the phase angle in radians. To view the magnitude and phase of a Butterworth filter:

d = designfilt("lowpassiir",FilterOrder=9, ...
    HalfPowerFrequency=0.4);
freqz(d)

Figure contains 2 axes objects. Axes object 1 with title Phase, xlabel Normalized Frequency (\times\pi rad/sample), ylabel Phase (degrees) contains an object of type line. Axes object 2 with title Magnitude, xlabel Normalized Frequency (\times\pi rad/sample), ylabel Magnitude (dB) contains an object of type line.

The unwrap function is also useful in frequency analysis. unwrap unwraps the phase to make it continuous across 360° phase discontinuities by adding multiples of ±360°, as needed. To see how unwrap is useful, design a 25th-order lowpass FIR filter:

h = fir1(25,0.4);

Obtain the frequency response with freqz and plot the phase in degrees:

[H,f] = freqz(h,1,512,2);
plot(f,angle(H)*180/pi)
grid

Figure contains an axes object. The axes object contains an object of type line.

It is difficult to distinguish the 360° jumps (an artifact of the arctangent function inside angle) from the 180° jumps that signify zeros in the frequency response. unwrap eliminates the 360° jumps:

plot(f,unwrap(angle(H))*180/pi)

Figure contains an axes object. The axes object contains an object of type line.

Alternatively, you can use phasez to see the unwrapped phase:

phasez(h,1)

Figure contains an axes object. The axes object with title Phase Response, xlabel Normalized Frequency ( times pi blank rad/sample), ylabel Phase (radians) contains an object of type line.

See Also

| | | |