The phase of the frequency response is called the phase response. Like the phase of any complex number, it is given by the arctangent of the imaginary part of divided by its real part, and it specifies the delay of the filter at each frequency. The phase response is a good way to look at short filter delays which are not directly perceivable as causing an ``echo''.4.4 For longer delays in audio, it is usually best to study the filter impulse response, which is output of the filter when its input is (an ``impulse''). We will show later that the impulse response is also given by the inverse z transform of the filter transfer function (or, equivalently, the inverse Fourier transform of the filter frequency response).
In this example, the phase response is
A specific case is plotted in Fig.3.10b, corresponding to the amplitude response in Fig.3.10a. The impulse response is plotted in Fig.3.8. The matlab code for producing these figures is shown in Fig.3.11. (The plotting utility plotfr is given in §J.4.) In Octave or the Matlab Signal Processing Toolbox, a figure similar to Fig.3.10 can be produced by typing simply
% efr.m - frequency response computation in Matlab/Octave % Example filter: g1 = 0.5^3; B = [1 0 0 g1]; % Feedforward coeffs g2 = 0.9^5; A = [1 0 0 0 0 g2]; % Feedback coefficients Nfft = 1024; % FFT size Nspec = 1+Nfft/2; % Show only positive frequencies f=[0:Nspec-1]/Nfft; % Frequency axis Xnum = fft(B,Nfft); % Frequency response of FIR part Xden = fft(A,Nfft); % Frequency response, feedback part X = Xnum ./ Xden; % Should check for divide by zero! clf; figure(1); % Matlab-compatible plot plotfr(X(1:Nspec),f);% Plot frequency response cmd = 'print -deps ../eps/efr.eps'; disp(cmd); eval(cmd);