5.7 Convolution and Filtering 341
wmax = 10; % maximum frequency
[w, Hm, Ha] = freqresps(n, d, wmax); % frequency response
splane(n, d) % plotting of poles and zeros
The following is the functionfreqrespsused to compute the magnitude and phase response
of the filter with the given numerator and denominator coefficients.
function [w, Hm, Ha] = freqresps(b, a, wmax)
w = 0:0.01:wmax;
H = freqs(b, a, w);
Hm = abs(H); % magnitude
Ha = angle(H)∗180/pi; % phase in degrees
n Band-pass filter: Letting the output of the filter be the voltage across resistor, we find that
the transfer function has a zero at zero, so that the frequency response is zero at=0.
Whengoes to infinity, one of the two poles cancels the zero effect so that the other pole
makes the frequency response tend to zero.
n High-pass filter: When the output of the filter is the voltage across the inductor the filter is
high pass. In this case there is a double zero ats=0, and the poles are located as before.
Thus, when=0 the magnitude response is zero due to the double zeros at zero, and
whengoes to infinity the effect of two poles and the two zeros cancel out giving a
constant magnitude response, which corresponds to a high-pass filter.
The results for the band-pass and the high-pass filters are shown in Figure 5.11. Notice that the
frequency response of the band-pass and the high-pass filter is determined by the ’number’
of zeros at the origin. The ’location’ of zeros, like in the all-pass filter we consider next, also
determines the frequency response.
(b) All-pass filter:The poles and the zeros of an all-pass filter have the same imaginary parts, but
the negative of its real part. At any frequency in thej-axis the lengths of the vectors from the
poles equal the length of the vectors from the zeros to the frequency in thejaxis. Thus the
magnitude response of the filter is unity. The following changes to the above script are needed
for the all-pass filter:
clear all
clf
n = [1−2.5 1];
d = [1 2.5 1];
wmax = 10;
freqresps(n, d, wmax)
The results are shown in Figure 5.12. n
5.7.4 Spectrum Analyzer...................................................................
Aspectrum analyzeris a device that measures the spectral characteristics of a signal. It can be imple-
mented as a bank of narrow band band-pass filters with fixed bandwidths covering the desired
frequencies (see Figure 5.13). The power at the output of each filter is computed and displayed at the
corresponding center frequency. Another possible implementation is using a band-pass filter with an
adjustable center frequency, with the power in its bandwidth being computed and displayed [16].