672 C H A P T E R 11: Introduction to the Design of Discrete Filters
When designing the Butterworth filter we only need to find the minimal orderNgiven that the
half-power frequency is specified. We find thatN=15 satisfies the specifications. Using this value
with the given discrete half-power frequency the functionbuttergives the coefficients of the filter.
See Figure 11.17 for the results.
The design of the Chebyshev filter with orderN=15 and half-power frequencyωhp=0.4πcannot
be done directly with the functioncheby1, as we do not have the passband frequencyωp. Using
the equation to compute the half-power frequency, we solve forωpafter we give a value toαmax
(arbitrarily chosen to be 0.001 dB), which allows us to compute the ripple factorε. See the script
part corresponding to the Chebyshev design. The functioncheby1with inputsN,αmax, andωp
gives the coefficients of the designed filter. Using the coefficients we plot the poles and the zeros,
the magnitude and the phase responses, and the loss function, as shown in Figure 11.17. According
to the loss function plots the Chebyshev filter displays a sharper response in the transition band
than the Butterworth filter, as expected.
% Butterworth/Chebyshev filters for analog signal
wh = 0.4∗pi;ws = 0.5∗pi; alphamin = 40;Fs = 20000;
% Butterworth
N = log10((10ˆ(0.1∗alphamin)-1))/(2∗log10(tan(ws/2)/tan(wh/2))); N = ceil(N)
% [b,a] = butter(N,wh/pi); % to get Butterworth filter get rid of ‘ % ’
% Chebyshev
alphamax = 0.001;
epsi = sqrt(10ˆ(0.1∗alphamax)-1);
% computation of wp for Chebyshev design
wp = 2∗atan(tan(0.5∗wh)/(cosh(acosh(sqrt(10ˆ(0.1∗3.01)-1)/epsi)/N))); wp = wp/pi;
[b,a] = cheby1(N,alphamax,wp);
% magnitude and phase
[H,w] = freqz(b,a);w = w/pi;M = length(H);f = w∗Fs/2;
alpha0 = -20;H = H∗10;
% to verify specs
spec2 = alpha0 + alphamin∗ones(1,M);
hpf = alpha0 + 3.01∗ones(1,M);
alpha = -20∗log10(abs(H));
Ha = unwrap(angle(H)); n
11.4.4 Rational Frequency Transformations
As indicated before, the conventional approach to filter design is to obtain first a prototype low-pass
filter and then to transform it into different types of filters by means of frequency transformations.
The magnitude specifications remain unchanged.
When using analog filters to design IIR discrete filters the frequency transformation could be done in
two ways:
n Transform a prototype low-pass analog filter into a desired analog filter, which in turn is converted
into the desired discrete filter using the bilinear or other transformation.