In working with phase delay, it is often necessary to ``unwrap'' the phase response . Phase unwrapping ensures that all appropriate multiples of have been included in . We defined simply as the complex angle of the frequency response , and this is not sufficient for obtaining a phase response which can be converted to true time delay. If multiples of are discarded, as is done in the definition of complex angle, the phase delay is modified by multiples of the sinusoidal period. Since LTI filter analysis is based on sinusoids without beginning or end, one cannot in principle distinguish between ``true'' phase delay and a phase delay with discarded sinusoidal periods when looking at a sinusoidal output at any given frequency. Nevertheless, it is often useful to define the filter phase response as a continuous function of frequency with the property that or (for real filters). This specifies how to unwrap the phase response at all frequencies where the amplitude response is finite and nonzero. When the amplitude response goes to zero or infinity at some frequency, we can try to take a limit from below and above that frequency.
Matlab and Octave have a function called
implements a numerical algorithm for phase unwrapping.
Figures 7.6.2 and 7.6.2 show the effect of the
unwrap function on the phase response of the example elliptic
lowpass filter of §7.5.2, modified to contract the zeros from
the unit circle to a circle of radius
[B,A] = ellip(4,1,20,0.5); % design lowpass filter B = B .* (0.95).^[1:length(B)]; % contract zeros by 0.95 [H,w] = freqz(B,A); % frequency response theta = angle(H); % phase response thetauw = unwrap(theta); % unwrapped phase responseIn Fig.7.6.2, the phase-response minimum has ``wrapped around'' to the top of the plot. In Fig.7.6.2, the phase response is continuous. We have contracted the zeros away from the unit circle in this example, because the phase response really does switch discontinuously by radians when frequency passes through a point where the phases crosses zero along the unit circle (see Fig.7.3(b)). The unwrap function need not modify these discontinuities, but it is free to add or subtract any integer multiple of in order to obtain the ``best looking'' discontinuity. Typically, for best results, such discontinuities should alternate between and , making the phase response resemble a distorted ``square wave'', as in Fig.7.3(b). A more precise example appears in Fig.10.2.