Abstract
Filtering is an important aspect of signal processing. It allows desired frequency components of a signal to pass through the system without distortion and suppresses the undesired frequency components. One of the most important steps in the design of a digital filter is to obtain a realizable transfer function H(z), satisfying the given frequency response specifications. In the case of the design of an IIR filter, it is required to confirm that H(z) is stable. The most common technique used in designing IIR digital filters involves first designing an analog prototype lowpass filter and then transforming the prototype to a digital filter. In this chapter, the design of analog lowpass filters is first described. Second, frequency transformations for transforming analog lowpass filter into bandpass, bandstop, or highpass analog filters are considered.
Access provided by CONRICYT-eBooks. Download chapter PDF
Similar content being viewed by others
Keywords
- Chebyshev Low-pass Filter
- Passband Edge Frequency
- Stopband Ripple
- Normalized Transfer Function
- Suitable Sampling Frequency
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
Filtering is an important aspect of signal processing. It allows desired frequency components of a signal to pass through the system without distortion and suppresses the undesired frequency components. One of the most important steps in the design of a digital filter is to obtain a realizable transfer function H(z), satisfying the given frequency response specifications. In the case of the design of an IIR filter, it is required to confirm that H(z) is stable. The most common technique used in designing IIR digital filters involves first designing an analog prototype lowpass filter and then transforming the prototype to a digital filter. In this chapter, the design of analog lowpass filters is first described. Second, frequency transformations for transforming analog lowpass filter into bandpass, bandstop, or highpass analog filters are considered. Next, the design of IIR filters is discussed and illustrated with numerical examples. Further, the design of IIR filters using MATLAB is demonstrated with a number of examples Also, the design of IIR filters using graphical user interface MATLAB filter design SPTOOL is discussed and illustrated with examples. Finally, some application examples of IIR filters for audio processing are included.
5.1 Analog Lowpass Filter Design
A number of approximation techniques for the design of analog lowpass filters are well established [1,2,3,4]. The design of analog lowpass filter using Butterworth, Chebyshev I, Chebyshev II (inverse Chebyshev), and elliptic approximations is discussed in this section.
5.1.1 Filter Specifications
The specifications for an analog lowpass filter with tolerances are depicted in Fig. 5.1, where
-
\( \Omega _{\text{p}} \)—passband edge frequency
-
\( \Omega _{\text{s }} \)—stopband edge frequency
-
\( \delta_{\text{p}} \)—peak ripple value in the passband
-
\( \delta_{\text{s}} \)—peak ripple value in the stopband
-
Peak passband ripple in dB = \( \alpha_{\text{p}} = - 20\log_{10} \left( {1 - \delta_{\text{p}} } \right) \) dB
-
Minimum stopband ripple in dB = \( \alpha_{\text{s}} = - 20\log_{10} (\delta_{\text{s}} ) \) dB
-
Peak ripple value in passband \( \delta_{\text{p}} = 1 - 10^{{ - \alpha_{\text{p}} /20}} \)
-
Peak ripple value in stopband \( \delta_{\text{s}} = 10^{{ - \alpha_{\text{s}} /20}} \)
5.1.2 Butterworth Analog Lowpass Filter
The magnitude-square response of an \( N{\text{th}} \)-order analog lowpass Butterworth filter is given by
Two parameters completely characterizing a Butterworth lowpass filter are \( \Omega _{\text{c}} \) and N. These are determined from the specified band edges \( \Omega _{\text{p}} \) and \( \Omega _{\text{c}} \), and peak passband ripple \( \alpha_{\text{p}} \), and minimum stopband attenuation \( \alpha_{\text{s}} \). The first (2N − 1) derivatives of \( \left| {H_{\text{a}} (j\Omega } \right|^{2} \) at \( \Omega = 0 \) are equal to zero. Thus, the Butterworth lowpass filter is said to have a maximally flat magnitude at \( \Omega = 0 \). The gain in dB is given by 10 log10 \( \left| {H_{\text{a}} (j\Omega } \right|^{2} \). At \( \Omega =\Omega _{\text{c}} \), the gain is 10 log10(0.5) = −3 dB; therefore, \( \Omega _{\text{c}} \) is called the 3 dB cutoff frequency. The loss in dB in a Butterworth filter is given by
For \( \Omega =\Omega _{\text{p}} , \) the passband attenuation is given by
For \( \Omega =\Omega _{\text{s}} \), the stopband attenuation is
Equations (5.3) and (5.4) can be rewritten as
From Eqs. (5.5) to (5.6), we obtain
Equation (5.7) can be rewritten as
From Eq. (5.8), solving for N we get
Since the order N must be an integer, the value obtained is rounded up to the next higher integer. This value of N is used in either Eq. (5.5) or Eq. (5.6) to determine the 3-dB cutoff frequency \( \Omega _{\text{c}} \). In practice, \( \Omega _{\text{c}} \) is determined by Eq. (5.6) that exactly satisfies stopband specification at \( \Omega _{\text{c}} \), while the passband specification is exceeded with a safe margin at \( \Omega _{\text{p}} \) [2]. We know that \( \left| {H\left( {j\Omega } \right)} \right|^{2} \) may be evaluated by letting \( s = j\Omega \) in \( H\left( s \right)H\left( { - s} \right) \), which may be expressed as
If \( \Omega _{\text{c}} = 1 \), the magnitude response \( \left| {H_{N} \left( {j\Omega } \right) } \right| \) is called the normalized magnitude response. Now, we have
where
Since \( \left| {s_{k} } \right| = 1, \) we can conclude that there are 2N poles placed on the unit circle in the s-plane. The normalized transfer function can be formed as
where \( p_{l} \) for l = 1, 2, …, N are the left half s-plane poles. The complex poles occur in conjugate pairs.
For example, in the case of N = 2, from Eq. (5.12), we have
The poles in the left half of the s-plane are
Hence,
and
In the case of N = 3,
The left half of s-plane poles are
Hence
and
The following MATLAB Program 5.1 can be used to obtain the Butterworth normalized transfer function for various values of N.
Program 5.1
Analog Butterworth lowpass filter normalized transfer function
-
N = input(‘enter order of the filter’);
-
[z,p,k] = buttap(N)% determines poles and zeros
-
disp(‘Poles are at’);disp(p);
-
[num,den] = zp2tf(z,p,k);
-
%Print coefficients in powers of s
-
disp(‘Numerator polynomial’);disp(num);
-
disp(‘Denominator polynomial’);disp(den);
-
sos = zp2sos(z,p,k);%determines coefficients of second order sections
The normalized Butterworth polynomials generated from the above program for typical values of N are tabulated in Table 5.1.
The magnitude response of the normalized Butterworth lowpass filter for some typical values of N is shown in Fig. 5.2. From this figure, it can be seen that the response monotonically decreases in both the passband and the stopband as Ω increases. As the filter order N increases, the magnitude responses in both the passband and the stopband are improved with a corresponding decrease in the transition width. Since the normalized transfer function corresponds to \( \Omega _{\text{c}} = 1 \), the transfer function of the lowpass filter corresponding to the actual \( \Omega _{\text{c}} \) can be obtained by replacing s by \( (s/\Omega _{\text{c}} ) \) in the normalized transfer function.
Example 5.1
Design a Butterworth analog lowpass filter with 1 dB passband ripple, passband edge frequency \( \Omega _{\text{p}} = 2000\pi \) rad/s, stopband edge frequency \( \Omega _{\text{s}} = 10{,}000\pi \) rad/s, and a minimum stopband ripple of 40 dB.
Solution
Since \( \alpha_{\text{s}} \) = 40 dB, \( \alpha_{\text{p}} \) = 1 dB, \( \Omega _{\text{p}} = 2000\pi \), and \( \Omega _{\text{s}} = 10{,}000\pi \)
Hence from Eq. (5.9),
Since the order must be an integer, we choose N = 4.
The normalized lowpass Butterworth filter for N = 4 can be formulated as
From Eq. (5.6), we have
The transfer function for \( \Omega _{\text{c}} = 9935 \) can be obtained by replacing s by \( \left( {\frac{s}{{\Omega _{\text{c}} }}} \right) = \left( {\frac{s}{9935}} \right) \) in \( H_{N} \left( s \right) \)
5.1.3 Chebyshev Analog Lowpass Filter
-
Type 1 Chebyshev lowpass filter
The magnitude-square response of an \( N{\text{th}} \)-order analog lowpass Type 1 Chebyshev filter is given by
where \( T_{N} \left(\Omega \right) \) is the Chebyshev polynomial of order \( N \)
The loss in dB in a Type 1 Chebyshev filter is given by
For \( \Omega =\Omega _{\text{p}} \), \( T_{N} \left(\Omega \right) = 1 \), and the passband attenuation is given by
From Eq. (5.17), \( \varepsilon \) can be obtained as
For \( \Omega =\Omega _{\text{s}} \), the stopband attenuation is
Since \( (\Omega _{\text{s}} /\Omega _{\text{p}} ) > 1 \), the above equation can be written as
Substituting Eq. (5.18) for \( \varepsilon \) in the above equation and solving for N, we get
We choose N to be the lowest integer satisfying (5.21). In determining N using the above equation, it is convenient to evaluate \( { \cosh }^{ - 1} \left( x \right) \) by applying the identity \( { \cosh }^{ - 1} \left( x \right) = { \ln }\left( {x + \sqrt {x^{2} - 1} } \right) \).
The poles of the normalized Type 1 Chebyshev filter transfer function lie on an ellipse in the s-plane and are given by [5]
Also, the normalized transfer function is given by
where
and
As an illustration, consider the case of N = 2 with a passband ripple of 1 dB. From Eq. (5.18), we have
Hence
Therefore, from (5.25a), the poles of the normalized Chebyshev transfer function are given by
Hence
Also, from (5.25b), we have
Thus for N = 2, with a passband ripple of 1 dB, the normalized Chebyshev transfer function is
Similarly for N = 3, for a passband ripple of 1 dB, we have
Thus,
Also, from (5.25b),
Hence, the normalized transfer function of Type 1 Chebyshev lowpass filter for N = 3 is given by
The following MATLAB Program 5.2 can be used to form the Type 1 Chebyshev normalized transfer function for a given order and passband ripple.
Program 5.2
Analog Type 1 Chebyshev lowpass filter normalized transfer function
-
N = input(‘enter order of the filter’);
-
Rp = input(‘enter passband ripple in dB’);
-
[z,p,k] = cheb1ap(N,Rp)% determines poles and zeros
-
disp(‘Poles are at’);disp(p);
-
[num,den] = zp2tf(z,p,k);
-
%Print coefficients in powers of s
-
disp(‘Numerator polynomial’);disp(num);
-
disp(‘Denominator polynomial’);disp(den);
The normalized Type 1 Chebyshev polynomials generated from the above program for typical values of N and passband ripple of 1 dB are tabulated in Table 5.2.
The typical magnitude responses of a Type 1 Chebyshev lowpass filter for N = 3, 5, and 8 with 1 dB passband ripple are shown in Fig. 5.3. From this figure, it is seen that Type 1 Chebyshev lowpass filter exhibits equiripple in the passband with a monotonic decrease in the stopband.
Example 5.2
Design a Type 1 Chebyshev analog lowpass filter for the specifications given in Example 5.1.
Solution
Since \( \alpha_{\text{s}} \) = 40 dB, \( \alpha_{\text{p}} \) = 1 dB, \( \Omega _{\text{p}} = 2000\pi \), and \( \Omega _{\text{s}} = 10000\pi \)
Since the order of the filter must be an integer, we choose the next higher integer value 3 for N. The normalized Type 1 Chebyshev lowpass filter for N = 3 with a passband ripple of 1 dB is given from Table 5.2 as
The transfer function for \( \Omega _{\text{p}} = 2000\pi \) is obtained by substituting \( s = \left( {s/\Omega _{\text{p}} } \right) = \left( {s/2000\pi } \right) \) in \( H_{N} \left( s \right) \)
-
Type 2 Chebyshev Filter
The squared-magnitude response of Type 2 Chebyshev lowpass filter, which is also known as the inverse Chebyshev filter, is given by
The order N can be determined using Eq. (5.21). The Type 2 Chebyshev filter has both poles and zeros, and the zeros are on the jΩ axis. The normalized Type 2 Chebyshev lowpass filter, or the normalized inverse Chebyshev filter (normalized to \( \Omega _{\text{s}} = 1) \), may be formed as [4]
where
For example, if we consider N = 3 with a stopband ripple of 40 dB, then from (5.28e),
Hence,
Using (5.28c) and (5.28d), we have
Hence,
Thus, from (5.28b), the poles are
Also, using (5.28a), the zeros are given by
Finally, from (5.28f),
Therefore, the normalized Type 2 Chebyshev lowpass filter for N = 3 with a stopband ripple of 40 dB is given by
The following MATLAB Program 5.3 can be used to form the Type 2 Chebyshev normalized transfer function for a given order and stopband ripple.
Program 5.3
Analog Type 2 Chebyshev lowpass filter normalized transfer function
-
N = input(‘enter order of the filter’);
-
Rs = input(‘enter stopband attenuation in dB’);
-
[z,p,k] = cheb2ap(N,Rs);% determines poles and zeros
-
disp(‘Poles are at’);disp(p);
-
[num,den] = zp2tf(z,p,k);
-
%Print coefficients in powers of s
-
disp(‘Numerator polynomial’);disp(num);
-
disp(‘Denominator polynomial’);disp(den);
The normalized Type 2 Chebyshev transfer functions generated from the above program for typical values of N with a stopband ripple of 40 dB are tabulated in Table 5.3.
The typical magnitude response of a Type 2 Chebyshev lowpass filter for N = 2 and 7 with 20 dB stopband ripple is shown in Fig. 5.4. From this figure, it is seen that Type 2 Chebyshev lowpass filter exhibits monotonicity in the passband and equiripple in the stopband.
Example 5.3
Design a Type 2 Chebyshev lowpass filter for the specifications given in Example 5.1.
Solution
The order N is chosen as 3, as in Example 5.2, since the equation for order finding is the same for both Type 1 and Type 2 Chebyshev filters. The normalized Type 2 Chebyshev lowpass filter for N = 3 with a stopband ripple of 40 dB has already been found earlier and is given by
For \( \Omega _{\text{s}} = 10{,}000\pi , \) the corresponding transfer function can be obtained by substituting \( s = \left( {s/\Omega _{\text{s}} } \right) = \left( {s/10{,}000\pi } \right) \) in the above expression for \( H_{N} \left( s \right) \). Thus, the required filter transfer function is
5.1.4 Elliptic Analog Lowpass Filter
The square-magnitude response of an elliptic lowpass filter is given by
where \( U_{N} \left( x \right) \) is the Jacobian elliptic function of order N and \( \varepsilon \) is a parameter related to the passband ripple. In an elliptic filter, a constant k, called the selectivity factor, representing the sharpness of the transition region is defined as
A large value of k represents a wide transition band, while a small value indicates a narrow transition band.
For a given set of \( \Omega _{\text{p}} \), \( \Omega _{\text{s}} \), \( \alpha_{\text{p}} \) and \( \alpha_{\text{s}} \), the filter order can be estimated using the formula [5]
where \( \rho \) can be computed using
The following MATLAB Program 5.4 can be used to form the elliptic normalized transfer function for given filter order, and passband ripple and stopband attenuation. The normalized passband edge frequency is set to 1.
Program 5.4
Analog elliptic lowpass filter normalized transfer function
-
N = input(‘enter order of the filter’);
-
Rp = input(‘enter passband ripple in dB’);
-
Rs = input(‘enter stopband attenuation in dB’);
-
[z,p,k] = ellipap(N,Rp,Rs)% determines poles and zeros
-
disp(‘Poles are at’);disp(p);
-
[num,den] = zp2tf(z,p,k);
-
%Print coefficients in powers of s
-
disp(‘Numerator polynomial’);disp(num);
-
disp(‘Denominator polynomial’);disp(den);
The normalized elliptic transfer functions generated from the above program for typical values of N and stopband ripple of 40 dB are tabulated in Table 5.4.
The magnitude response of a typical elliptic lowpass filter is shown in Fig. 5.5, from which it can be seen that it exhibits equiripple in both the pass and the stopbands.
For more details on elliptic filters, readers may refer to [2, 4, 6].
Example 5.4
Design an elliptic analog lowpass filter for the specifications given in Example 5.1.
Solution
and
Substituting these values in Eqs. (5.32) and (5.34), we get
and hence
Choose N = 3. Then, for N = 3, a passband ripple of 1 dB, and a stopband ripple of 40 dB, the normalized elliptic transfer function is as given in Table 5.4. For \( \Omega _{\text{p}} = 2000\pi \), the corresponding transfer function can be obtained by substituting \( s = \left( {s/\Omega _{\text{p}} } \right) = \left( {s/2000\pi } \right) \) in the expression for \( H_{N} \left( s \right). \) Thus, the required filter transfer function is
5.1.5 Bessel Filter
Bessel filter is a class of all-pole filters that provide linear phase response in the passband and characterized by the transfer function [5]
where the coefficients \( a_{N} \) are given by
The magnitude responses of a third-order Bessel filter and Butterworth filter are shown in Fig. 5.6, and the phase responses of the same filters with the same order are shown in Fig. 5.7. From these figures, it is seen that the magnitude response of the Bessel filter is poorer than that of the Butterworth filter, whereas the phase response of the Bessel filter is more linear in the passband than that of the Butterworth filter.
5.1.6 Comparison of Various Types of Analog Filters
The magnitude response and phase response of the normalized Butterworth, Chebyshev Type 1, Chebyshev Type 2, and elliptic filters of the same order are compared with the following specifications:
filter order = 8, maximum passband ripple = 1 dB, and minimum stopband ripple = 35 dB.
The following MATLAB program is used to generate the magnitude and phase responses for these specifications.
Program 5.5
Magnitude and phase responses of analog filters of order 8 with a passband ripple of 1 dB and a stopband ripple of 35 dB.
-
clear all;clc;
-
[z,p,k] = buttap(8);
-
[num1,den1] = zp2tf(z,p,k);[z,p,k] = cheb1ap(8,1);
-
[num2,den2] = zp2tf(z,p,k);[z,p,k] = cheb2ap(8,35);
-
[num3,den3] = zp2tf(z,p,k);[z,p,k] = ellipap(8,1,35);
-
[num4,den4] = zp2tf(z,p,k);
-
omega = [0:0.01:5];
-
h1 = freqs(num1,den1,omega);h2 = freqs(num2,den2,omega);
-
h3 = freqs(num3,den3,omega);h4 = freqs(num4,den4,omega);
-
ph1 = angle(h1);ph1 = unwrap(ph1);
-
ph2 = angle(h2);ph2 = unwrap(ph2);
-
ph3 = angle(h3);ph3 = unwrap(ph3);
-
ph4 = angle(h4);ph4 = unwrap(ph4);
-
Figure (1),plot(omega,20*log10(abs(h1)),‘-’);hold on
-
plot(omega,20*log10(abs(h2)),‘-’);hold on
-
plot(omega,20*log10(abs(h3)),‘:’);hold on
-
plot(omega,20*log10(abs(h4)),‘-.’);
-
xlabel(‘Normalized frequency’);ylabel(‘Gain,dB’);axis([0 5-80 5]);
-
legend(‘Butterworth’,‘Chebyshev Type 1’,‘Chebyshev Type 2’,‘Elliptic’);hold off
-
Figure(2),plot(omega,ph1,‘-’);hold on
-
plot(omega,ph2,‘-’);hold on
-
plot(omega,ph3,‘:’);hold on
-
plot(omega,ph4,‘-.’)
-
xlabel(‘Normalized frequency’);ylabel(‘Phase,radians’);axis([0 5 -8 0]);
-
legend(‘Butterworth’,‘Chebyshev Type 1’,‘Chebyshev Type 2’,‘Elliptic’);
The magnitude and phase responses for the above specifications are shown in Fig. 5.8. The magnitude response of Butterworth filter decreases monotonically in both the passband and the stopband with wider transition band. The magnitude response of the Chebyshev Type 1 exhibits ripples in the passband, whereas the Chebyshev Type 2 has approximately the same magnitude response to that of the Butterworth filter. The transition band of both the Type 1 and Type 2 Chebyshev filters is the same, but less than that of the Butterworth filter. The elliptic filter exhibits an equiripple magnitude response both in the passband and in the stopband with a transition width smaller than that of the Chebyshev Type 1 and Type 2 filters. But the phase response of the elliptic filter is more nonlinear in the passband than that of the phase response of the Butterworth and Chebyshev filters. If linear phase in the passband is the stringent requirement, then the Bessel filter is preferred, but with a poor magnitude response.
Another way of comparing the various filters is in terms of the order of the filter required to satisfy the same specifications. Consider a lowpass filter that meets the passband edge frequency of 450 Hz, stopband edge frequency of 550 Hz, passband ripple of 1 dB, and stopband ripple of 35 dB. The orders of the Butterworth, Chebyshev Type 1, Chebyshev Type 2, and elliptic filters are computed for the above specifications and listed in Table 5.5. From this table, we can see that elliptic filter can meet the specifications with the lowest filter order.
5.1.7 Design of Analog Highpass, Bandpass, and Bandstop Filters
The analog highpass, bandpass, and bandstop filters can be designed using analog frequency transformations. In this design process, first, the analog prototype lowpass filter specifications are derived from the desired specifications of the analog filter using suitable analog-to-analog transformation. Next, by using the specifications so obtained, a prototype lowpass filter is designed. Finally, the transfer function of the desired analog filter is determined from the transfer function of the prototype analog lowpass transfer function using the appropriate analog-to-analog frequency transformation. The lowpass-to-lowpass, lowpass-to-highpass, lowpass-to-bandpass, and lowpass-to-bandstop analog transformations are considered next.
-
Lowpass to Lowpass:
Let \( \Omega _{\text{p}} = 1 \) and \( \hat{\Omega }_\text{p} \) be the passband edge frequencies of the normalized prototype low pass filter and the desired lowpass filter, as shown in Fig. 5.9. The transformation from the prototype lowpass to the required lowpass must convert \( \hat{\Omega } = 0 \) to \( \Omega = 0 \) and \( \hat{\Omega } = \pm \infty \) to \( \Omega = \pm \infty \). The transformation such as \( s = k\hat{s} \) or \( \Omega = k{\hat{\Omega }} \) achieves the above transformation for any positive value of k. If k is chosen to be \( \text{(1}/\hat{\Omega }_{\text{p}}) \), then \( \hat{\Omega }_\text{p} \) gets transformed to \( \Omega _{\text{p}} = 1 \), and \( \hat{\Omega }_{\text{s}} \) to \( \Omega _{\text{s}} = \) \( \hat{\Omega }_{\text{s}} \) / \( \hat{\Omega }_{\text{p}} \). Since \( \Omega _{\text{p}} = \) 1 is the passband edge frequency for the normalized Type I Chebyshev and elliptic lowpass filters, we have the design equations for these filters as
Also, the transfer function HLP(\( \hat{s} \)) for these filters is related to the corresponding normalized transfer function \( H_{N} (s) \) by
However, in the case of a Butterworth filter, since \( \Omega = 1 \) corresponds to the cutoff frequency of the filter, the transfer function HLP(\( \hat{s} \)) for the Butterworth filter is related to the normalized lowpass Butterworth transfer function \( H_{N} (s) \) by
where \( \hat{\Omega }_{\text{c}} \) is the cutoff frequency of the desired Butterworth filter and is given by Eq. (5.5). For similar reasons, the transfer function HLP(\( \hat{s} \)) for the Type 2 Chebyshev filter is related to the normalized transfer function \( H_{N} (s) \) by
-
Lowpass to Highpass:
Let the passband edge frequencies of the prototype lowpass and the desired highpass filters be \( \Omega _{\text{p}} \) = 1 and \( \hat{\Omega }_\text{p} \), as shown in Fig. 5.10. The transformation from prototype lowpass to the desired highpass must transform \( \hat{\Omega } = 0 \) to \( \Omega = \infty \) and \( \hat{\Omega } = \infty \) to \( \Omega = 0 \). The transformation such as \( s = k/\hat{s} \) or \( \hat{\Omega } = \infty \) achieves the above transformation for any positive value of k. By transforming \( \hat{\Omega}_\text{p} \) to \( \Omega _{\text{p}} \) = 1, the constant k can be determined as k = \( \hat{\Omega }_\text{p} \). Thus, design equations are
and the desired transfer function HHP(\( \hat{s} \)) is related to the normalized lowpass transfer function \( H_{N} (s) \) by
Equations (5.38a) and (5.38b) hold for all filters except for Butterworth and Type 2 Chebyshev filter. For Butterworth
For Type 2 Chebyshev filter, the design equations are
and
-
Lowpass to Bandpass
The prototype lowpass and the desired bandpass filters are shown in Fig. 5.11. In this figure, \( \hat{\Omega }_{\text{p1}} \) is the lower passband edge frequency, \( \hat{\Omega }_{\text{p2}} \) the upper passband edge frequency, \( \hat{\Omega }_{\text{s1}} \) the lower stopband edge frequency, and \( \hat{\Omega }_{\text{s2}} \) the upper stopband edge frequency of the desired bandpass filter. Let us denote by Bp, the bandwidth of the passband, and by \( \hat{\Omega }_{\text{mp}} \) the geometric mean between the passband edge frequencies of the bandpass filter, i.e.,
Now, consider the transformation
As a consequence of this transformation, it is seen that \( \hat{\Omega } = 0, \) \( \hat{\Omega }_{\text{p1}} \), \( \hat{\Omega }_{\text{mp}} \), \( \hat{\Omega }_{\text{p2}} \), and \( \infty \) transform to the frequencies \( \Omega = - \infty , \) −1, 0, +1, and \( \infty , \) respectively, for the normalized lowpass filter. Also, the transformation (5.41) transforms the frequencies \( \hat{\Omega }_{\text{s1}} \) and \( \hat{\Omega }_{\text{s2}} \) to \( \Omega _{\text{s}}^{{\prime }} \) and \( \Omega _{\text{s}}^{{{\prime \prime }}} \), respectively, where
and
In order to satisfy the stopband requirements and to have symmetry of the stopband edges in the lowpass filter, we choose \( \Omega _{\text{s}} \) to be the min \( \{ \left| {A_{1} } \right|,\left| {A_{2} } \right|\} . \) Thus, the spectral transformation (5.41) leads to the following design equations for the normalized lowpass filter (except in the case of the Type 2 Chebyshev filter)
where \( A_{1} \) and \( A_{2} \) are given by (5.42) and (5.43), respectively, and the desired highpass transfer function HBP(\( \hat{s} \)) can be obtained from the normalized lowpass transfer function \( H_{N} (s) \) using (5.41). In the case of the Type 2 Chebyshev filter, the equation corresponding to (5.44a) is
-
Lowpass to Bandstop
The prototype lowpass and the desired bandstop filters are shown in Fig. 5.12. In this figure, \( \hat{\Omega }_{\text{p1}} \) is the lower passband edge frequency, \( \hat{\Omega }_{\text{p2}} \) the upper passband edge frequency, \( \hat{\Omega }_{\text{s1}} \) the lower stopband edge frequency, and \( \hat{\Omega }_{\text{s2}} \) the upper stopband edge frequency of the desired bandstop filter. Let us now consider the transformation
where \( \hat{\Omega}_{\text{ms}} \) is the geometric mean between the stopband edge frequencies of the bandstop filter, i.e.,
As a consequence of this transformation, it is seen that \( \hat{\Omega } = 0 \) and \( \infty \) transform to the frequency \( \hat{\Omega } = 0 \) for the normalized lowpass filter. Now, we transform the lower stopband edge frequency \( \hat{\Omega }_{\text{s1 }} \) to the stopband edge frequency \( \Omega _{\text{s}} \) of the normalized lowpass filter; hence,
where \( B_\text{s} = \left( {\hat{\Omega }_{\text{s2}} - \hat{\Omega }_{\text{s1}} } \right) \) is the bandwidth of the stopband. Also, the upper stopband edge frequency \( \hat{\Omega }_{\text{s2}} \) is transformed to
Hence, the constant k is given by
As a consequence, the passband edge frequencies \( \hat{\Omega }_{\text{p1}} \) and \( \hat{\Omega }_{\text{p2}} \) are transformed to
and
In order to satisfy the passband requirement as well as to satisfy the symmetry requirement of the passband edge of the normalized lowpass filter, we have to choose the higher of \( \left| {\Omega _{\text{p}}^{{\prime }} } \right| \) and \( \left| {\Omega _{\text{p}}^{{{\prime \prime }}} } \right| \) as \( \Omega _{\text{p}} \). Since for the normalized filter (except for the case of Type 2 Chebyshev filter), \( \Omega _{\text{p}} = 1, \) we have to choose \( \Omega _{\text{s}} \) to be the lower of \( \left\{ {\left| {A_{1} } \right|,\left| {A_{2} } \right|} \right\} \). Hence, the design equations for the normalized lowpass filter (except for the Type 2 Chebyshev) are
where
and the transfer function of the required bandstop filter is
For the Type 2 Chebyshev filter, Eq. (5.49a) would be replaced by
For further details on analog frequency transformations, readers may refer to [7].
5.2 Design of Digital Filters from Analog Filters
5.2.1 Digital Filter Specifications
The digital filter frequency response specifications are often in the form of a tolerance scheme. The specifications for a low pass filter are depicted in Fig. 5.13.
The following parameters are usually used as the specifications.
-
\( \omega_{\text{p}} \)—passband edge frequency
-
\( \omega_{\text{s }} \)—stopband edge frequency
-
\( \delta_{\text{p}} \)—peak ripple value in the passband
-
\( \delta_{\text{s}} \)—peak ripple value in the stopband
Generally, the passband edge frequency \( (f_{\text{p}} ) \), the stopband edge frequency \( (f_{\text{s}} ) \), and the sampling frequency \( (F_{\text{T}} ) \) are represented in Hz. But, the digital filter design methods require normalized angular edge frequencies in radians. The normalized angular edge frequencies \( \omega_{\text{p}} \) and \( \omega_{\text{s}} \) can be obtained using the following relations
where T is the sampling period.
5.2.2 Design of Digital Filters Using Impulse-Invariant Method
In this method, the impulse response of an analog filter is uniformly sampled to obtain the impulse response of the digital filter, and hence, this method is called the impulse-invariant method. The process of designing an IIR filter using this method is as follows:
-
Step 1
Design an analog filter to meet the given frequency specifications. Let Ha(s) be the transfer function of the designed analog filter. We assume for simplicity that Ha(s) has only simple poles. In such a case, the transfer function of the analog filter can be expressed in partial fraction form as
$$ H_{\text{a}} \left( s \right) = \sum\limits_{k = 1}^{N} {\frac{{A_{k} }}{{s - p_{k} }}} $$(5.52)where A k is the residue of H(s) at the pole p k .
-
Step 2
Calculate the impulse response h(t) of this analog filter by applying the inverse Laplace transformation on H(s). Hence,
$$ h_{\text{a}} \left( t \right) = \sum\limits_{k = 1}^{N} {A_{k} {\text{e}}^{{p_{k} t}} u_{\text{a}} \left( t \right)} $$(5.53) -
Step 3
Sample the impulse response of the analog filter with a sampling period T. Then, the sampled impulse response h(n) can be expressed as
$$ \begin{aligned} h\left( n \right) & = \left. {h_{\text{a}} \left( t \right)} \right|_{t = nT} \\ & = \sum\limits_{k = 1}^{N} {(A_{k} {\text{e}}^{{p_{k} t}} )^{n} u\left( n \right)} \\ \end{aligned} $$(5.54) -
Step 4
Apply the z-transform on the sampled impulse response obtained in Step 3, to form the transfer function of the digital filter, i.e., H(z) = Z[h(n)]. Thus, the transfer function H(z) for the impulse-invariant method is given by
$$ H\left( z \right) = \sum\limits_{k = 1}^{N} {\frac{{A_{k} }}{{1 - {\text{e}}^{{p_{k} T}} z^{ - 1} }}} $$(5.55)
This impulse-invariant method can be extended for the case when the poles are not simple [8].
Example 5.5
Design a third-order Butterworth digital filter using impulse-invariant technique. Assume a sampling period of \( T = 1\,\text{s} \).
Solution
For \( N = 3 \), the transfer function of a normalized Butterworth filter is given by
Hence, from (5.55), we have
Example 5.6
Design a Butterworth filter using the impulse-invariant method for the following specifications:
Solution
From (5.1), the magnitude-squared function of the Butterworth filter is
Substituting the requirements in the above magnitude function, we get
The solution of the above two equations leads to
Approximating to the nearest higher value, we have \( N = 2 \). Substituting N = 2 in
we get \( \Omega _{\text{c}} = 0.231\pi \). Also, for \( N = 2 \) the transfer function of the normalized Butterworth filter is
Hence, from (5.37c),
Since T = 1, we have
-
Disadvantage of Impulse-Invariant Method
The frequency responses of the digital and analog filters are related by
From Eq. (5.56), it is evident that the frequency response of the digital filter is not identical to that of the analog filter due to aliasing in the sampling process. If the analog filter is band-limited with
then the digital filter frequency response is of the form
In the above expression, if T is small, the gain of the filter becomes very large. This can be avoided by introducing a multiplication factor T in the impulse-invariant transformation. In such a case, the transformation would be
and \( H\left( z \right) \) would be
Also, the frequency response is
Hence, the impulse-invariant method is appropriate only for band-limited filters, i.e., lowpass and bandpass filters, but not suitable for highpass or bandstop filters where additional band limiting is required to avoid aliasing. Thus, there is a need for another mapping method such as bilinear transformation technique which avoids aliasing.
5.2.3 Design of Digital Filters Using Bilinear Transformation
In order to avoid the aliasing problem mentioned in the case of the impulse-invariant method, we use the bilinear transformation, which is a one-to-one mapping from the s-plane to the z-plane; that is, it maps a point in the s-plane to a unique point in the z-plane and vice versa. This is the method that is mostly in designing an IIR digital filter from an analog filter. This approach is based on the trapezoidal rule, and for details, one could refer to [8]. Consider the bilinear transformation given by
Then, a transfer function \( H_{\text{a}} \left( s \right) \) in the analog domain is transformed in the digital domain as
Also, from (5.62) we have
We now study the mapping properties of the bilinear transformation. Consider a point \( s = - \sigma + j\Omega \) in the left half of the s-plane. Then, from (5.64), we get
Hence, the left half of the s-plane maps into the interior of the unit circle in the z-plane (see Fig. 5.14). Similarly, it can be shown that the right half of the s-plane maps into the exterior of the unit circle in the z-plane. For a point z on the unit circle, \( z = {\text{e}}^{j\omega } , \) we have from (5.62)
Thus
or
showing that the positive and negative imaginary axes of the s-plane are mapped respectively into the upper and lower halves of the unit circle in the z-plane. We thus see that the bilinear transformation avoids the problem of aliasing encountered in the impulse-invariant method, since it maps the entire imaginary axis in the s-plane onto the unit circle in the in the z-plane. Further, in view of the mapping, this transformation converts a stable analog filter into a stable digital filter.
-
Warping effect
The price paid, however, is in the introduction of a distortion in the frequency axis due to the nonlinear relation between \( \Omega \) and \( \omega , \) exhibited particularly at higher frequencies, as shown in Fig. 5.15. This behavior is called the warping effect. This can be corrected by ‘prewarping’ the analog filter specifications. The procedure to be followed is as follows:
-
Step 1
From the digital filter specifications, prewarp the critical frequencies, such as the cutoff frequency, passband edge, stopband edge using Eq. (5.67).
-
Step 2
From these new critical frequencies, obtain the transfer function \( H_{\text{a}} \left( s \right) \) of the analog filter using the methods already described.
-
Step 3
Use the bilinear transformation given by Eq. (5.62) to obtain the corresponding digital transfer function \( H\left( z \right). \)
Example 5.7
Design a low pass Butterworth IIR digital filter using bilinear transformation for the following specifications:
3 dB cutoff frequency \( \omega_{\text{c}} = 0.2\pi \) and \( \left| {H\left( {{\text{e}}^{j\omega } } \right)} \right| \le 0.317\,{\text{for}}\,0.4\,\pi \le \omega \le \pi \).
Solution
From Eq. (5.1), the magnitude-squared function of the Butterworth filter is
As bilinear transformation is used and \( \omega_{\text{c}} = 0.2\pi \), prewarping of the cutoff frequency yields
From the magnitude response specification, we obtain
Solving the above equation gives N = 2. Hence,
Thus,
The digital transfer function \( H\left( z \right) \) is now obtained by using Eq. (5.62) in the above transfer function \( H_{\text{a}} \left( s \right). \)
Example 5.8
Consider the following analog transfer function
-
(i)
Is it possible to obtain the corresponding digital transfer function using the impulse-invariant method?
-
(ii)
Is it possible to obtain the corresponding digital transfer function using bilinear transformation?
Solution
-
(i)
\( H_{\text{a}} (s) = \frac{{s^{2} - 3s + 3}}{{s^{2} + 3s + 3}} \) represents an allpass system.
According to the impulse-invariant design, using Eq. (5.56),
The aliasing terms will destroy the allpass nature of the continuous time filter. Therefore, one cannot design a corresponding digital system using the impulse-invariant method.
-
(ii)
The bilinear transformation only warps the frequency axis. The magnitude response is not affected; therefore, an allpass filter will map to an allpass filter. Thus, one can design a corresponding digital system using the bilinear transformation.
Example 5.9
Design a low pass IIR digital filter using the bilinear transformation for the following specifications:
Solution
Prewarping the critical frequencies, we have the passband and stopband edge frequencies of the analog filter to be
Since
we have
and
Solving the above two equations, we get N = 4.6; hence, we choose N = 5. Using this value of N, we can calculate \( \Omega _{\text{c}} \) to be \( \Omega _{\text{c}} = 0.398. \) Hence, we have
Now substituting for s using Eq. (5.62), we get the required digital transfer function to be
Example 5.10
Design a lowpass digital filter with 3 dB cutoff frequency at 50 Hz and attenuation of at least 10 dB for frequency larger than 100 Hz. Assume a suitable sampling frequency.
Solution
Assume the sampling frequency as 500 Hz. Then,
Prewarping of the above-normalized frequencies yields
Substituting these values in \( \left( {\Omega _{\text{s}} /\Omega _{\text{c}} } \right)^{2N} = 10^{{0.1\alpha_{\text{s}} }} - 1 \) and solving for N, we get
Hence, the order of the Butterworth filter is 2. The normalized lowpass Butterworth filter for N = 2 is given by
The transfer function Hc(s) corresponding to \( \Omega _{\text{c}} = 0.325 \) is obtained by substituting
in the expression for H N (s); hence,
The digital transfer function H(z) of the desired filter is now obtained by using the bilinear transformation (5.52) in the above expression:
Example 5.11
Design a lowpass Butterworth IIR filter for the following specifications:
-
Passband edge frequency: 1000 Hz
-
Stopband edge frequency: 3000 Hz
-
Passband ripple: 2 dB
-
Stopband ripple: 20 dB
Assume a suitable sampling frequency and use the bilinear transformation.
Solution
Assuming the sampling frequency as 8 kHz, the normalized angular band edge frequencies are given by
By prewarping these frequencies, we get
For the prototype analog lowpass filter, we get
Using these values, the order of the filter is computed using Eq. (5.9) as
Hence, we choose N = 2. The normalized lowpass Butterworth filter for N = 2 is given by
Substituting the values of \( \hat{\Omega }_\text{s} \) and N in Eq. (5.6), we obtain
Solving for \( \hat{\Omega }_\text{c} , \) we get \( \hat{\Omega }_\text{c} = 0.7654. \) The transfer function corresponding to \( \hat{\Omega }_\text{c} = 0.7654 \) is obtained by substituting \( s = \left( {s/\hat{\Omega }_\text{c} } \right) = \left( {s/0.7654} \right) \) in \( H_{N} (s) \); hence,
The digital transfer function H(z) of the desired filter is now obtained as
Example 5.12
Design a lowpass Chebyshev Type 1 IIR filter for the following specifications:
-
Passband edge frequency: 1 kHz
-
Stopband edge frequency: 3 kHz
-
Sampling frequency: 10 kHz
-
Passband ripple: 1 dB
-
Stopband ripple: 40 dB
Solution
The normalized angular band edge frequencies are given by
By prewarping these frequencies, we get
For the prototype analog lowpass filter
Hence from (5.21), we have
Hence, we choose N = 3. For N = 3, from Table 5.2, the normalized transfer function is given by
The transfer function corresponding to \( \hat{\Omega }_\text{p} \) = 0.32492 is obtained by substituting s = \( (s/\hat{\Omega }_\text{p} ) \) = (s/0.32492) in \( H_{N} (s) \); hence,
The digital transfer function \( H_{\text{LP}} \left( z \right) \) of the desired lowpass filter is now obtained as
Example 5.13
Design a lowpass Chebyshev Type 2 IIR digital filter for the specifications given in Example 5.12.
Solution
The order of the filter required is the same as in Example 5.12, i.e., N = 3. For, N = 3, from Table 5.3, the normalized transfer function is given by
for which the stopband edge is at \( \Omega _{s} = 1. \) The transfer function corresponding to the stopband edge \( \hat{\Omega }_\text{s} = 1.3764 \) is obtained by substituting \( s = \left( {s/\hat{\Omega }_\text{s} } \right) = \left( {s/1.3764} \right) \) in the expression for \( H_{N} (s) \); hence,
The digital transfer function \( H_{\text{LP}} \left( z \right) \) of the desired lowpass filter is now obtained as
Example 5.14
Design an elliptic lowpass IIR filter for the following specifications:
-
Passband edge frequency: 800 Hz
-
Stopband edge frequency: 1600 Hz
-
Sampling frequency: 4 kHz
-
Passband ripple: 1 dB
-
Stopband ripple: 40 dB
Solution
The normalized angular bandedge frequencies are given by
Prewarping these frequencies, we get
For the prototype analog lowpass filter
Hence, we choose N = 3. For N = 3, from Table 5.4, the normalized transfer function is
The transfer function corresponding to the passband edge \( \hat{\Omega }_\text{p} = 0.72654 \) is obtained by substituting \( s = \left( {s/\hat{\Omega }_\text{p} } \right) = \left( {s/0.72654} \right) \) in the expression for \( H_{N} (s) \); hence,
The digital transfer function \( H_{\text{LP}} \left( z \right) \) of the desired lowpass filter is now obtained as
Example 5.15
Design a Butterworth IIR digital highpass filter for the following specifications:
-
Passband edge frequency: 40 Hz
-
Stopband edge frequency: 25 Hz
-
Sampling frequency: 100 Hz
-
Passband ripple: 1 dB
-
Stopband ripple: 20 dB
Solution
The normalized angular bandedge frequencies are
Prewarping these frequencies, we get
For the prototype analog lowpass filter, we have
Substituting these values in Eq. (5.9), the order of the filter is given by
Hence, we choose N = 3. From Table 5.1, the third-order normalized Butterworth lowpass filter transfer function is given by
Substituting the values of \( \Omega _{\text{s}} \) and N in Eq. (5.6), we obtain
Solving for \( \Omega _{\text{c}} \), we get \( \Omega _{\text{c}} = 1. 4 3 0 9 \).
The analog transfer function of the lowpass filter is obtained from the above transfer function by substituting \( s = \frac{s}{{\Omega _{\text{c}} }} = \frac{s}{ 1. 4 3 0 9} \); hence,
From the above transfer function, the analog transfer function of the highpass filter can be obtained by substituting \( s = \frac{{\hat{\varOmega}_\text{p}}}{s} = \frac{3.0777}{s} \)
The digital transfer function of the required highpass filter is obtained by using the bilinear transformation:
Thus,
Example 5.16
Design a Type 1 Chebyshev IIR digital highpass filter for the following specifications:
-
Passband edge frequency: 700 Hz
-
Stopband edge frequency: 500 Hz
-
Sampling frequency: 2 kHz
-
Passband ripple: 1 dB
-
Stopband ripple: 40 dB
Solution
Normalized angular bandedge frequencies are
Prewarping these frequencies, we get
For the prototype analog lowpass filter
Substituting these values in Eq. (5.21), the order of the filter is given by
Hence, we choose N = 5. From (5.18), we have
Using Eqs. (5.24) and (5.25a, 5.25b), the normalized transfer function is given by
where
and
Substituting N = 5 and k = 1, 2, 3, 4, 5 in the above equations, we get
and
Hence,
The analog transfer function of the highpass filter can be obtained from the above transfer function by substituting \( s = (\hat{\Omega }_\text{p}/s) = \left( {1.9626105/s} \right); \)
The digital transfer function of the highpass filter can be obtained by using bilinear transformation:
Thus,
Example 5.17
Using bilinear transformation, design a digital bandpass Butterworth filter with the following specifications:
-
Lower passband edge frequency: 200 Hz
-
Upper passband edge frequency: 400 Hz
-
Lower stopband edge frequency: 100 Hz
-
Upper stopband edge frequency: 500 Hz
-
Passband ripple: 2 dB
-
Stopband ripple: 20 dB
Assume a suitable sampling frequency.
Solution
Assuming the sampling frequency to be 2000 Hz, the normalized angular bandedge frequencies are given by
The prewarped analog frequencies are given by
We now obtain the corresponding specifications for the normalized analog lowpass filter using the lowpass-to-bandpass transformation. From Eqs. (5.42) to (5.43), we have
and
Now using (5.44a), we get the specifications for the normalized analog lowpass filter to be
Substituting these values in Eq. (5.9), the order of the filter is given by
We choose N = 4. The transfer function of the fourth-order normalized Butterworth lowpass filter is given by
Substituting the values of \( \Omega _{\text{s}} \) and N in Eq. (5.6), we obtain
Solving for \( \Omega _{\text{c}} \), we get \( \Omega _{\text{c}} = 1. 0 7 1 2 \). The analog transfer function of the lowpass filter is obtained from the above transfer function by substituting \( s = \frac{s}{{\Omega _{\text{c}} }} = \frac{s}{ 1. 0 7 1 2} \)
To arrive at the analog transfer function of the bandpass filter, we use in the above expression the lowpass-to-bandpass transformation given by (5.41), namely
to obtain
The digital bandpass filter is now obtained by using the bilinear transformation in the above expression. Thus,
Example 5.18
Using bilinear transformation, design a digital bandpass Chebyshev Type 1 filter with the following specifications:
-
Lower passband edge frequency: 200 Hz
-
Upper passband edge frequency: 400 Hz
-
Lower stopband edge frequency: 100 Hz
-
Upper stopband edge frequency: 500 Hz
-
Passband ripple: 1 dB
-
Stopband ripple: 10 dB
Assume a suitable sampling frequency.
Solution
The prewarped analog frequencies, as well as the values of A1 and A2, are the same as for the above example. Hence, for the prototype analog lowpass filter, the specifications are
Substituting these values in Eq. (5.21), the order of the filter is given as
We choose N = 2. From (5.18), we have
Using Eqs. (5.25a) and (5.25b), the poles of the normalized lowpass transfer function are given by
and
Hence,
Thus for N = 2, with a passband ripple of 1 dB, the normalized transfer function is
To arrive at the analog transfer function of the bandpass filter, we use in the above expression the lowpass-to-bandpass transformation given by Eq. (5.41), namely
to obtain
We now use the bilinear transformation in the above to obtain the required digital bandpass filter transfer function as
Example 5.19
Using bilinear transformation, design a digital bandstop Butterworth filter with the following specifications:
-
Lower passband edge frequency: 35 Hz
-
Upper passband edge frequency: 215 Hz
-
Lower stopband edge frequency: 100 Hz
-
Upper stopband edge frequency: 150 Hz
-
Passband ripple: 3 dB
-
Stopband ripple: 15 dB
Assume a suitable sampling frequency.
Solution
Assuming a sampling frequency of 500 Hz, the normalized angular bandedge frequencies are given by
The prewarped analog frequencies are given by
We now obtain the corresponding specifications for the normalized analog lowpass filter using the lowpass-to-bandstop transformation. From Eq. (5.49b), we have
Now using (5.49a), we get the specifications for the normalized analog lowpass filter to be
Substituting these values in Eq. (5.9), the order of the filter is given by
We choose \( N = 1 \). The transfer function of the first-order normalized Butterworth lowpass filter is
Substituting the values of \( \Omega _{\text{s}} \) and N in Eq. (5.6), we obtain
Solving for \( \Omega _{\text{c}} \), we get \( \Omega _{\text{c}} = 1. 1 8 1 8 \). The analog transfer function of the lowpass filter is obtained from H N (s) by substituting \( s = \frac{s}{{\Omega _{\text{c}} }} = \frac{s}{ 1. 1 8 1 8} \)
To arrive at the analog transfer function of the bandstop filter, we use in the above expression the lowpass-to-bandstop transformation given by (5.49c), namely
to obtain
The transfer function of the required digital bandstop filter is now obtained by using the bilinear transformation:
Example 5.20
Design an elliptic IIR digital highpass filter with the specifications given in Example 5.16.
Solution
Normalized angular bandedge frequencies are given as
Prewarping these frequencies, we get
For the prototype analog lowpass filter
From (5.30) and (5.32) to (5.34), we get
Substituting these values in Eq. (5.31), the order of the filter is given by
Let us choose \( N = 4 \). Then from Table 5.4, we have
To arrive at the analog transfer function of the highpass filter, the variable s in the above-normalized transfer function is to be replaced by \( (\hat{\Omega }_\text{p} /s) = \left( {1.9626105/s} \right) \)
Then, the required highpass filter in the digital domain is given by
5.3 Design of Digital Filters Using Digital-to-Digital Transformations
In the design of analog filters, we start with designing a normalized lowpass filter, and then through an appropriate frequency transformation of the lowpass filter, the filter for the given magnitude response specifications is obtained. We can adopt a similar procedure by first designing a digital lowpass filter and then applying frequency transformation \( z \to g\left( {\hat{z}} \right) \) in the discrete domain to obtain highpass, bandpass, bandstop, or another lowpass filter. The transformation function \( g\left( z \right) \) has to satisfy certain conditions in order to produce the desired magnitude specifications.
-
(i)
The transformation function \( g\left( {\hat{z}} \right) \) should be a rational function of \( \hat{z} \).
-
(ii)
The transformation \( z \to g\left( {\hat{z}} \right) \) should map the interior of the unit circle in the \( z \)-plane into the interior of the unit circle in the \( \hat{z} \)-plane, the exterior to the exterior, and the unit circle in the \( z \)-plane into the unit circle in the \( \hat{z} \)-plane. Hence, the transformed filter resulting from a stable filter will remain stable.
Table 5.6 shows a set of transformations that can be used to for this purpose, and interested readers may refer to the work of Constantinides [9] for details. For illustration, we consider the cases of lowpass-to-lowpass and lowpass-to-highpass transformations.
-
Lowpass-to-lowpass transformation
Consider the transformation function
where \( b \) is real. Then,
Let the passband edge of the original lowpass filter be \( \omega_{\text{p}} \) and that of the desired lowpass filter be \( \hat{\omega }_{\text{p}} \). It can easily be seen that \( g\left( {\hat{z}} \right) \) maps \( \hat{\omega } = 0 \) into \( \omega = 0, \) and \( \hat{\omega } = \pm \pi \) into \( \omega = \pm \pi \). We now choose the value of b so that \( g\left( {\hat{z}} \right) \) maps the frequency \( \hat{\omega }_{\text{p}} \) to \( \omega_{\text{p}} ; \) then, we will have the required mapping function. Hence, we should have
Hence,
Thus, the transformation (5.69) with the value of b given by (5.70) will transform a digital lowpass filter with passband edge at \( \omega_{\text{p}} \) into another digital lowpass filter with its passband edge at \( \hat{\omega }_{\text{p}} \).
-
Lowpass-to-highpass transformation
Consider the transformation function
where \( b \) is real. Then,
Let the passband edge of the original lowpass filter be \( \omega_{\text{p}} \) and that of the desired highpass filter be \( \hat{\omega }_{\text{p}} \). It can easily be seen that \( g\left( {\hat{z}} \right) \) maps \( \hat{\omega } = 0 \) into \( \omega = \pm \pi , \) and \( \hat{\omega } = \pm \pi \) into \( \omega = 0 \). We now choose the value of b so that \( g\left( {\hat{z}} \right) \) maps the frequency \( \hat{\omega }_{\text{p}} \) to \( - \omega_{\text{p}} ; \) then, we will have the required mapping function. Hence, we should have
Hence,
Thus, the transformation (5.71) with the value of b given by (5.72) will transform a digital lowpass filter with passband edge at \( \omega_{\text{p}} \) into a digital highpass filter with its passband edge at \( \hat{\omega }_{\text{p}} \).
Similarly, the other transformations given in Table 5.6 can be established [Con70].
These transformations can easily be applied to obtain highpass, bandpass, band reject, or another lowpass filter as follows:
-
Step 1
Find the normalized transfer function H N (z) of a lowpass filter using an approximation technique
-
Step 2
Obtain the passband edge \( \omega_{\text{p}} \) in H N (z)
-
Step 3
Find the function H(z) from H N (z) using the appropriate transformation from Table 5.6.
An important aspect of the filters designed using the above transformations is that the passband edge of the lowpass or the highpass filter can be varied by varying the single parameter b. Similarly, in the case of bandpass or bandstop filters, both the lower and upper passband edges can be varied by varying two parameters, namely a and b [9, 10].
Example 5.21
Consider the second-order lowpass digital filter of Example 5.7 with −3 dB cutoff frequency of 0.2\( \pi \). Redesign this lowpass filter by applying the lowpass-to-lowpass digital transformation so that the −3 dB cutoff frequency moves from \( 0.2\pi \) to \( 0.3\pi . \)
Solution
Since \( \omega_{\text{p}} = 0.2\pi \) and \( \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\omega }_{\text{p}} = 0.3\pi \), we obtain
From the solution of Example 5.7, the digital transfer function with −3 dB cutoff frequency at \( 0.2\pi \) is
Hence, the desired low pass transfer function with −3 dB cutoff frequency at \( 0.3\pi \) is given by
Example 5.22
Consider the design of a highpass filter by applying lowpass-to-highpass digital transformation to the second-order lowpass digital filter of Example 5.11. The desired passband edge frequency is 0.5\( \pi \).
Solution
To apply the digital lowpass-to-highpass transformation shown in Table 5.6, b is first computed as
From the solution of Example 5.11, the digital transfer function with passband edge frequency at \( 0.25\pi \) is
Hence, the desired highpass transfer function with passband edge frequency at \( 0.5\pi \) is given by
5.4 Design of IIR Digital Filters Using MATLAB
Various types of M-files are included in the signal processing toolbox of MATLAB software for the design of IIR digital filters. The use of these M-files is illustrated by the following examples:
Example 5.23
An IIR digital lowpass filter is required to meet the following specifications:
-
Passband ripple ≤0.5 dB
-
Passband edge \( 1.2\,{\text{kHz}} \)
-
Stopband attenuation ≥40 dB
-
Stopband edge \( 2\,{\text{kHz}} \)
-
Sample rate \( 8\,{\text{kHz}} \)
Design a (i) digital Butterworth filter, (ii) Type 1 Chebyshev digital filter, (iii) Type 2 Chebyshev digital filter, and (iv) digital elliptic filter.
Solution
The following MATLAB program is used to design the required filters.
Program 5.6
Butterworth, Chebyshev, and elliptic IIR lowpass filter design
-
flag = input(‘enter 1 for BWF, 2 for Type 1 CSF, 3 for Type 2 CSF, 4 for Ellip = ’);
-
%BWT stands for Butterworth filter, CSF for Chebyshev filter, and Ellip for
-
%Elliptic filter
-
Wp = input(‘Normalized passband edge = ’);
-
Ws = input(‘Normalized stopband edge = ’);
-
Rp = input(‘Passband ripple in dB = ’);
-
Rs = input(‘Minimum stopband attenuation in dB = ’);
-
if flag ==1
-
[N,Wn] = buttord(Wp,Ws,Rp,Rs)
-
[b,a] = butter(N,Wn);
-
end
-
if flag ==2
-
[N,Wn] = cheb1ord(Wp,Ws,Rp,Rs)
-
[b,a] = cheby1(N,Rp,Wn);
-
end
-
if flag ==3
-
[N,Wn] = cheb2ord(Wp,Ws,Rp,Rs)
-
[b,a] = cheby2(N,Rs,Wn);
-
end
-
if flag ==4
-
[N,Wn] = ellipord(Wp,Ws,Rp,Rs)
-
[b,a] = ellip(N,Rp,Rs,Wn);
-
end
-
[h,omega] = freqz(b,a,256);
-
plot (omega/pi,20*log10(abs(h)));grid;
-
xlabel(‘\omega/\pi’); ylabel(‘Gain, dB’);
The magnitude responses of the designed lowpass filters are shown in Fig. 5.16.
Example 5.24
An IIR digital highpass filter is required to meet the following specifications:
-
Passband ripple ≤1 dB
-
Passband edge \( 800\,{\text{Hz}} \)
-
Stopband attenuation ≥60 dB
-
Stopband edge \( 400\,{\text{Hz}} \)
-
Sample rate \( 2000\,{\text{Hz}} \)
Design (i) a digital Butterworth filter, (ii) Type 1 Chebyshev digital filter, (iii) Type 2 Chebyshev digital filter, and (iv) digital elliptic filter
Solution
Program 5.6 can be used to design highpass filters with the following MATLAB functions for determining the coefficients b and a.
-
[b,a] = butter(N,Wn,‘high’); [b,a] = cheby1(N,Rp,Wn,‘high’);
-
[b,a] = cheby2(N,Rs,Wn,‘high’); [b,a] = ellip(N,Rp,Rs,Wn,‘high’);
The gain responses and filter orders for the Butterworth, Type 1 and Type 2 Chebyshev, and elliptic filters are shown in Fig. 5.17a–d, respectively.
Example 5.25
Design Butterworth, Type 1 Chebyshev bandpass, Type 2 Chebyshev, and elliptic bandpass digital filters satisfying the following specifications:
-
Lower passband edge \( \omega_{\text{p1}} = 0.4\pi \) rad
-
Upper passband edge \( \omega_{\text{p2}} = 0.6\pi \) rad
-
Lower stopband edge \( \omega_{\text{s1}} = 0.25\pi \) rad
-
Upper stopband edge \( \omega_{\text{s2}} = 0.7\pi \) rad
-
Passband ripple = \( 0.5\,{\text{dB}} \)
-
Stopband attenuation = \( 45\,{\text{dB}} \)
Solution
The following MATLAB program is used to design the desired filters.
Program 5.7
Butterworth, Chebyshev, and elliptic IIR bandpass Filters Design
-
flag = input(‘enter 1 for BWF, 2 for Type 1 CSF, 3 for Type 2 CSF, 4 for Ellip = ’);
-
%BWT stands for Butterworth filter, CSF for Chebyshev filter, and Ellip for
-
%Elliptic filter
-
Wp1 = input(‘Normalized lower passband edge = ’);
-
Wp2 = input(‘Normalized upper passband edge = ’);
-
Ws1 = input(‘Normalized lower stopband edge = ’);
-
Ws2 = input(‘Normalized upper stopband edge = ’);
-
Rp = input(‘Passband ripple in dB = ’);
-
Rs = input(‘Minimum stopband attenuation in dB = ’);
-
if flag ==1
-
[N,Wn] = buttord([Wp1 Wp2],[Ws1 Ws2],Rp,Rs);
-
[b,a] = butter(N,Wn);
-
end
-
if flag ==2
-
[N,Wn] = cheb1ord([Wp1 Wp2],[Ws1 Ws2],Rp,Rs);
-
[b,a] = cheby1(N,Rp,Wn);
-
end
-
if flag ==3
-
[N,Wn] = cheb2ord([Wp1 Wp2],[Ws1 Ws2],Rp,Rs);
-
[b,a] = cheby2(N,Rs,Wn);
-
end
-
if flag ==4
-
[N,Wn] = ellipord([Wp1 Wp2],[Ws1 Ws2],Rp,Rs);
-
[b,a] = ellip(N,Rp,Rs,Wn);
-
end
-
[h,omega] = freqz(b,a,256);
-
plot (omega/pi,20*log10(abs(h)));
-
grid;
-
xlabel(‘\omega/\pi’);
-
ylabel(‘Gain, dB’);
The gain responses and filter orders for the designed filters are shown in Fig. 5.18.
Example 5.26
Design Butterworth, Type 1 Chebyshev bandstop, Type 2 Chebyshev, and elliptic bandstop digital filter satisfying the following specifications:
-
Lower passband edge \( \omega_{\text{p1}} = 0.1\pi \) rad
-
Lower stopband edge \( \omega_{\text{s1}} = 0.2\pi \) rad
-
Upper passband edge \( \omega_{\text{p2}} = 0.5\pi \) rad
-
Upper stopband edge \( \omega_{{{\text{s}}2}} = 0.4\pi \) rad
-
Passband ripple \( 1\,{\text{dB}} \)
-
Stopband attenuation \( 40\,{\text{dB}} \)
Solution
Program 5.7 can be used to design bandstop filters with the following MATLAB functions for determining the coefficients b and a.
-
[b,a] = butter(N,Wn,‘stop’); [b,a] = cheby1(N,Rp,Wn,‘stop’);
-
[b,a] = cheby2(N,Rs,Wn,‘stop’); [b,a] = ellip(N,Rp,Rs,Wn,‘stop’);
The gain responses and filter orders for the designed filters are shown in Fig. 5.19.
Example 5.27
Design a filter using digital-to-digital transformation as required in Example 5.21.
Solution
To design the desired lowpass filter, the MATLAB command ‘iirlp2lp’ can be used for digital lowpass-to-lowpass transformation. The following MATLAB program is used to design the desired filter.
Program 5.8
Digital lowpass-to-lowpass transformation
-
clear all;
-
b1 = 0.068*[1 2 1]; % numerator coefficients of original LPF
-
a1 = [1-1.142 0.413];% denominator coefficients of original LPF
-
[num,den,anum,aden] = iirlp2lp(b1,a1,0.2,0.3);% coefficients of new LPF
-
[h1,omega] = freqz(b1,a1,256);
-
plot (omega/pi,20*log10(abs(h1)));
-
hold on
-
[h2,omega] = freqz(num,den,256);
-
plot (omega/pi,20*log10(abs(h2)),‘--’);
-
xlabel(‘\omega/\pi’); ylabel(‘Gain, dB’);
-
legend(‘original lowpass filter’,‘newlowpass filter’);grid;
The magnitude responses of the original filter and the new transformed filter are shown in Fig. 5.20. From this figure, it is observed that the requirements of the original and the transformed filters are fulfilled. The coefficients of the lowpass filter obtained using the above program are equal to those obtained in Example 5.21.
Example 5.28
Design a digital highpass filter using digital-to-digital transformation as required in Example 5.13.
Solution
The following MATLAB program is used to design the desired filter.
Program 5.9
Digital lowpass-to-highpass transformation
-
clear all;
-
b1 = [0.2195 0.439 0.2195]; % numerator coefficients of prototype lowpass filter HN (z)
-
a1 = [1 -0.31047 0.1887];% denominator coefficients of prototype lowpass filter HN (z)
-
[num,den,anum,aden] = iirlp2hp(b1,a1,0.25,0.5);% coefficients of desired highpass filter H(z)
-
[h,omega] = freqz(num,den,256);
-
plot (omega/pi,20*log10(abs(h)));
-
xlabel(‘\omega/\pi’); ylabel(‘Gain, dB’);grid;
The magnitude response of the desired filter is shown in Fig. 5.21.
From this figure, it is observed that the requirements of the transformed highpass filter are fulfilled. The coefficients of the highpass filter obtained using the above program are equal to those obtained in Example 5.22.
5.5 Design of IIR Filters Using MATLAB GUI Filter Designer SPTOOL
With the aid of MATLAB GUI filter designer SPTOOL, the filter satisfying the specifications can be designed using the following procedure [11]:
-
Step 1
Access the MATLAB’s GUI filter designer SPTOOL for the design of both FIR and IIR filters.
From MATLAB, type the following: sptool
-
Step 2
From the startup window startup.spt, select a new design and enter the specifications of the filter. Then, the MATLAB’s filter designer SPTOOL window with the characteristics of the designed filter is displayed.
-
Step 3
When finished, access the startup window again. Select \( \to \) Edit \( \to \) Name. Change name (enter new variable name).
-
Step 4
Select File \( \to \) Export \( \to \) Export to workspace the new variable name
-
Step 5
Access MATLAB’s workspace and type the following commands:
-
new variable name.tf.num;
-
round (new variable name.tf.num*2^15).
-
Example 5.29
Design an IIR lowpass digital filter using the bilinear transformation for the following specifications using (i) Butterworth, (ii) Chebyshev Type 1, and (iii) elliptic approximations:
-
Passband ripple ≤1 dB
-
Passband edge 4 kHz
-
Stopband attenuation ≥40 dB
-
Stopband edge 6 kHz
-
Sample rate 24 kHz
Solution
It can be designed by following the above stepwise procedure. After the execution of Steps 1 and 2, the SPTOOL in MATLAB7.0 for Butterworth lowpass filter, the filter characteristics displayed by the window is shown in Fig. 5.22.
From Fig. 5.22, the filter order obtained with MATLAB GUI filter designer SPTOOl is 10. The execution of Steps 3, 4, and 5 will display the designed filter coefficients and coded coefficients. Similarly, execution of the SPTOOL in MATLAB7.0 for Chebyshev Type 1 filter displays the filter characteristics as shown in Fig. 5.23. The order of the filter found to be 6. The execution of the SPTOOL for elliptic filter displays the filter characteristics as shown in Fig. 5.24. The order of the elliptic filter is found to be 4.
Example 5.30
Design a bandstop IIR elliptic digital filter operating at sampling frequency of 2 kHz with the passband edges at 300 and 750 Hz, stopband edges at 450 and 650 Hz, peak passband ripple of 0.5 dB, and minimum stopband attenuation of 30 dB. Use Bilinear transformation method to obtain the transfer function H(z).
Solution
Following the stepwise procedure used in the above example and execution of the SPTOOL in MATLAB7.0 for elliptic bandstop filter, the filter characteristics are shown in Fig. 5.25. The order of the designed filter is observed to be 6.
5.6 Design of Specialized Digital Filters by Pole-Zero Placement
There are certain specialized filters often used in digital signal processing applications in addition to the filters designed in the previous sections. These specialized filters can be directly designed based on placement of poles and zeros.
5.6.1 Notch Filter
The notch filter removes a single frequency f0, called the notch frequency. The magnitude of the notch filter at f0 can be made zero by placing a zero on the unit circle with \( \omega_{0} = \left( {2\pi f_{0} } \right)/F_{T} \) corresponding to the notch frequency, where F T is the sampling frequency. The bandwidth Bw of the notch filter can be controlled by placing pole at the same angle with the pole radius r < 1. The poles and zeros should occur in complex conjugate pairs. As such, the transfer function of a second-order notch filter can be formed as
which can be rewritten as
To ensure that the passband gain is unity, the gain factor \( b_{0} \) is to be chosen so that \( |H(1)| = 1 \). Hence, \( b_{0} \) is given by
If \( B_{{\text{W}}} \ll F_{{\text{T}}} \), the pole radius r can be approximated [12] as
The following example illustrates the design of a notch filter using MATLAB.
Example 5.31
Design a digital notch filter with notch frequency at 900 Hz, bandwidth of 100 Hz, and the sampling frequency of 11,025 Hz.
Solution
The following MATLAB Program 5.10 is used to design the desired notch filter and the pole-zero plot, and the magnitude response of the filter obtained from the program is shown in Fig. 5.26a, b, respectively.
Program 5.10
Design of a notch filter
-
clear;clc;
-
FT = 11025;
-
f0 = 900;% Notch frequency
-
Bw = 100;% Bandwidth
-
% Compute filter coefficients
-
W0 = 2*pi*f0/FT;
-
r = 1 - (Bw*pi/ FT);% pole radius
-
b0 = abs(1-2*r*cos(W0) + r^2)/abs(2-2*cos(W0));% gain
-
b = b0*[1-2*cos(W0) 1];% Numerator polynomial coefficients of transfer function
-
a = [1-2*r*cos(W0) r^2];% denominator polynomial coefficients of transfer function
-
% pole-zero plot
-
[z,p,k] = tf2zp(b,a);
-
figure(1),zplane(z,p)
-
% Plot magnitude response
-
N = 240
-
[H,f] = freqz (b,a,N, FT);
-
A = abs(H);
-
figure(2),plot (f,A)
-
xlabel(‘Frequency (Hz)’);ylabel(‘Magnitude’);
5.6.2 Comb Filter
Comb filters have a wide range of practical applications such as suppression of interference in LORAN navigation systems [13] and separation of solar and lunar spectral components in ionospheric measurements [14]. Comb filter is a filter with multiple passbands and stopbands with periodic frequency response with periodicity of \( \left( {2\pi /N} \right) \) where N is an integer. An Nth-order comb filter can be designed by placing N zeros equally spaced on the unit circle and N poles equally spaced around a circle of radius r < 1, but close to the unit circle. Thus, the poles correspond to the N roots of \( r^{N} \). Hence, the transfer function of an Nth-order comb notch filter is given by
And the transfer function for comb peaking filter is given by
The gain constant \( b_{0} \) is to be chosen so that the passband gain is unity at \( f = \frac{{f_{0} }}{2}, \) where \( F_{T} = Nf_{0} \).
Hence, \( b_{0} = \frac{{1 + r^{N} }}{2} \) for comb notching filter and \( b_{0} = \frac{{1 - r^{N} }}{2} \) for comb peaking filter. The bandwidth BW is related to the Q-factor of the filter by
The following MATLAB command can be used to design a comb notching filter or a comb peaking filter
where b and a are the coefficients of the numerator and denominator polynomials of the transfer function of the comb filter, N is the order of the comb filter, Bw is the bandwidth of the comb filter, and Type specifies the notch or peak. The following example illustrates the design of comb notching filter using MATLAB.
Example 5.32
Design a comb notch filter to suppress 50 Hz hum of overhead fluorescent lights in biomedical measurements. Choose the sampling frequency of 2200 Hz and the Q-factor of the filter as 35.
Solution
For this design, \( f_{0} = 50, F_{T} = 2200 \). Hence, using Eqs. (5.79) and (5.76), we have
The following MATLAB Program 5.11 is used to design the desired notch filter and the pole-zero plot, and the magnitude response of the filter obtained from the program is shown in Fig. 5.27a, b, respectively.
Program 5.11
Design of a comb notch filter
-
clear;clc;
-
FT = 2200;
-
f0 = 50;% Notch frequency
-
Bw = 8.9760;;% Bandwidth
-
N = FT/f0;
-
[b,a] = iircomb(N,Bw/Fs,‘notch’);
-
[z,p,k] = tf2zp(b,a);
-
Figure (1),
-
zplane(z,p)
-
% Plot magnitude response
-
N = 240
-
[H,f] = freqz (b,a,N, FT);
-
A = abs(H);
-
figure(2)
-
plot (f,A)
-
xlabel(‘Frequency (Hz)’);ylabel(‘Magnitude’);
5.7 Some Examples of IIR Filters for Audio Processing Applications
5.7.1 Suppression of Power Supply Hum in Audio Signals
By and large most of the audio processing systems are affected by the interference caused by the power supply hum at 50 Hz or 60 Hz. This can be avoided by using a second-order notch filter whose transfer function is given by
For example, consider a speech signal from the sound file ‘DT.wav’ [15]. The following MATLAB code is used to read the speech signal from the sound file, to add sinusoidal interference at 50 Hz to it, and to plot the power spectra of the interference added signal (x n ) as shown in Fig. 5.28.
-
[x, FT] = wavread(‘DT.wav’);%Reads the wav file to obtain speech signal x and sampling frequency FT
-
for i = 1:size(x)
-
xn(i) = x(i) + 2*sin(2*pi*50*i/ FT); % adds power supply hum at 50 Hz to the speech signal
-
end
-
wavwrite(xn, FT,‘DTn50.wav’);
-
[pxx,f] = psd(xn,256, FT);% power spectrum of the speech signal corrupted with power supply hum plot(f,10*log10(pxx));grid; xlabel(‘Frequency,Hz’);ylabel(‘Power spectrum,dB’);
In Fig. 5.28, the peak at 50 Hz with large magnitude of the power spectrum is due to the power supply hum at 50 Hz. To suppress the power supply hum, a digital IIR second-order notch filter of the form given in Eq. (5.73) is designed for the notch frequency f0 = 50 Hz and bandwidth Bw = 100 Hz. As such, the transfer function given by Eq. (5.80) becomes
The magnitude response of the notch filter described by the above transfer function is shown in Fig. 5.29.
To recover the original speech signal, the corrupted signal is passed through the designed notch filter, and the power spectrum of the recovered signal is shown in Fig. 5.30. From this figure, it can be observed that the peak at 50 Hz with large magnitude is suppressed and the speech signal is recovered. Also when the recovered signal is connected to a loudspeaker, its audio quality is observed to be the same, as that of the original speech signal.
5.7.2 Generation of Artificial Reverberations
The recorded sounds in a studio are unnatural to the listener, compared to the recorded sounds in a closed room. Digital filtering can be used to generate artificial reverberations, and by adding these reverberations to the studio recorded sounds as shown in Fig. 5.31, one can arrive at a pleasant-sounding reverberation.
An artificial reverberation generator, in general, is an interconnection scheme consisting of parallel connection of IIR filters in cascade with allpass reverberators as shown in Fig. 5.32.
The structures for IIR filters and allpass reverberators are shown in Fig. 5.33a, b, respectively.
Artificial reverberations can be generated by choosing different delays \( d_{i} , i = 1, \ldots , K + L \), and the multiplier constants \( a_{i} , i = 1, \ldots , K + L + 1 \), and \( b_{i} , i = 1, \ldots , K.\;{\text{For}}\;K = 4\;{\text{and}}\;L = 2, \) the reverberation generator shown in Fig. 5.31 corresponds to the Schroeder reverberator with four IIR filters and two allpass reverberators with delays given by
and multiplier constants
The reverberated sound generation scheme shown in Fig. 5.31 is implemented on music sound from sound file ‘utopia.wav’[website4]. The original music sound and the reverberated music sound waveforms are shown in Fig. 5.34a, b, respectively. The reverberated music sound is found to be more pleasant to hear than the original.
5.7.3 Audio Peaking Equalizers
With the availability of low-cost DSPs and recurrent usage of digital sounds, the need for audio equalizers has become crucial. By using a peaking equalizer filter section, a boost or cut is obtained in the vicinity of the center frequency. Peaking equalizer filter section is commonly known as parametric equalizer section, in which the gain is outlying from the boost or cut, so that a number of such sections can be arranged in series. Figure 5.35 shows a typical peaking equalizer comprised of cascaded IIR second-order filters.
The transfer function of an IIR second-order peaking filter is given by Robert [16]
where
-
\( b_{0} = 1 + \alpha \sqrt K , b_{1} = - 2{ \cos }\omega_{0} , b_{2} = 1 - \alpha \sqrt K \)
-
\( a_{0} = 1 + \frac{\alpha }{\sqrt K }, a_{1} = - 2{ \cos }\omega_{0} , a_{2} = 1 - \frac{\alpha }{\sqrt K } \)
-
\( \alpha = [\sin \omega_{0} ]\sinh \left( {\frac{\ln 2}{2}B_{\text{w}} \frac{{\omega_{0} }}{{\sin \omega_{0} }}} \right) \)
-
\( \omega_{0} = \frac{{2\pi f_{0} }}{{F_{T} }}, \,B_{\text{w}} = \frac{{2\pi b_{\text{w}} }}{{F_{T} }}, K = 10^{{\left( {G/20} \right)}} \)
-
\( f_{0} = {\text{Peak}}\,{\text{frequency}}\,{\text{in}}\,{\text{Hz}} \)
-
\( b_{\text{w}} = \) Bandwidth in \( {\text{Hz}} \)
-
\( F_{T} = {\text{Sampling}}\,{\text{frequency}} \)
-
\( K = \) Gain at the peak frequency \( f_{0} \)
-
\( G = \) Peak gain in \( {\text{dB}} \)
-
\( B_{\text{w}} = \) Bandwidth in octaves given by \( \omega_{ + } = \omega_{ - } 2^{{B_{\text{w}} }} , \) \( \omega_{ + } \) and \( \omega_{ - } \) being the upper and lower edge frequencies, where the gain in \( {\text{dB}} \) is \( G/2 \).
As an example, consider the design of a peaking equalizer (Fig. 5.35) satisfying the following specifications:
-
Peaking Filter 1: \( f_{0} = 1600\,{\text{Hz}} \), \( b_{\text{w}} = 800\,{\text{Hz}}, \) \( F_{\text{T}} = 44{,}100\,{\text{Hz}}, \) \( G = 20\,{\text{dB}} \)
-
Peaking Filter 2: \( f_{0} = 2400\,{\text{Hz}} \), \( b_{\text{w}} = 800\,{\text{Hz}}, \) \( F_{\text{T}} = 44{,}100\,{\text{Hz}}, \) \( G = 20\,\text{dB} \)
-
Peaking Filter 3: \( f_{0} = 3200\,{\text{Hz}} \), \( b_{\text{w}} = 800\,{\text{Hz}}, \) \( F_{\text{T}} = 44{,}100\,{\text{Hz}}, \) \( G = 20\,{\text{dB}} \)
The magnitude and phase responses of each of the three peaking equalizers are shown in Fig. 5.36.
The music sound from the sound file ‘original.wav’ [17] is applied to the peaking equalizer of Fig. 5.35 with the magnitude response and phase response as shown in Fig. 5.36. The original sound signal and the equalized sound signal are shown in Fig. 5.37a, b, respectively.
5.7.4 Generation and Detection of DTMF Tones
-
Dual-Tone Multifrequency Tone Generator
The DTMF tone generator can be developed using two IIR digital filters in parallel.
The DTMF generator for key ‘5’ is depicted in Fig. 5.38.
-
Dual-Tone Multifrequency Tone Detection Using the Modified Goertzel Algorithm
Based on the specified frequencies of each DTMF tone and the modified Goertzel algorithm, the stepwise procedure for DTMF tone detection is as follows [18]:
-
Step 1
For every digitized DTMF tone received, two nonzero frequency components are found from the following seven: 697, 770, 852, 941, 1209, 1336, and 1477 Hz.
-
Step 2
Apply the modified Goertzel algorithm to compute seven spectral values, which correspond to the seven frequencies mentioned in Step 1. The single-sided amplitude spectrum is computed using the following expression:
$$ A_{k} = \frac{{2\sqrt {\left| {X\left( k \right)} \right|^{2} } }}{N} $$(5.83) -
Step 3
Determine the Key by using two nonzero spectral components corresponding to the key is pressed.
-
Step 4
Determine the frequency bin number (frequency index) based on the sampling rate fs and the data size of N using the following relation:
$$ k = \frac{f}{{F_{T} }} \times N \left( { {\text{round}}\,{\text{off}}\,{\text{to}}\,{\text{integer}}} \right) $$(5.84)
Since the telephone industry has preset \( F_{T} \) the sampling frequency to 8 kHz and the DTMFs to 697, 770, 852, 941, 1209, 1336, and 1477, the filter length must be large enough to find the desired k value that corresponds to the DTMF frequencies. Therefore, there is a trade-off to be considered between the computation burden and better resolution. For this application report, the filter length, N, was chosen as 105, which is the smallest value that can fulfill DTMF detection. Table 5.7 shows the calculated k values for N = 105.
Now, compute the frequency bin k for each DTMF frequency with fs = 8000 Hz and N = 105 as tabulated in Table 5.7.
The DTMF detector block diagram is shown in Fig. 5.39.
-
Step 5.
Add all seven spectral values and divide the sum by 4 to obtain the threshold value
The logic operation outputs logic 1 for the spectrum value greater than the threshold value; otherwise, the logic operation outputs logic 0. The last-stage logic operation decodes the key information based on the 7-bit binary pattern.
The MATLAB simulation for decoding key 5 is shown in Program 5.12. The input is generated as shown in Fig. 5.38. After filtering, the calculated spectral values and the threshold value for decoding key 5 are displayed in Fig. 5.40, where only two spectral values corresponding to the frequencies of 770 and 1336 Hz are above the threshold and are encoded as logic 1. According to the key information in Fig. 5.39, the final logic operation decodes the key as 5.
Program 5.12
DTMF Detection Using Goertzel Algorithm
5.8 Problems
-
1.
For the following specifications, design a lowpass IIR digital Butterworth filter using the impulse-invariant method.
$$ \begin{aligned} & 0.8 \le \left| {H({\text{e}}^{j\omega } )} \right| \le 1\quad {\text{for}}\;\;0 \le \omega \le 0.3\uppi \\ & \quad \quad \left| {H({\text{e}}^{j\omega } )} \right| \le 0.4\quad {\text{for}}\;\;0.6\uppi \le \omega \le\uppi \\ \end{aligned} $$ -
2.
Using the bilinear transformation, design a lowpass IIR digital Butterworth filter with −3 dB cutoff at 150 Hz and stopband attenuation of 20 dB or greater at 600 Hz. The sampling frequency is 6000 Hz.
-
3.
Design a digital Butterworth highpass filter to meet the following specifications:
-
Passband edge frequency: 1000 Hz
-
Stopband edge frequency: 400 Hz
-
Passband ripple: 3 dB
-
Stopband ripple: 10 dB
Assume a suitable sampling frequency.
-
-
4.
Design a Butterworth IIR digital bandpass filter for the following specifications:
-
Lower passband edge frequency: 500 Hz
-
Upper passband edge frequency: 600 Hz
-
Lower stopband edge frequency: 100 Hz
-
Upper stopband edge frequency: 1000 Hz
-
Passband ripple: 2 dB
-
Stopband ripple: 10 dB
Assume 4000 Hz as the sampling frequency. Use bilinear transformation.
-
-
5.
Design a Chebyshev IIR digital lowpass filter for the following specifications:
-
Passband cutoff frequency: 400 Hz
-
Stopband cutoff frequency: 600 Hz
-
Passband ripple: 1 dB
-
Stopband ripple: 10 dB
Assume a suitable sampling frequency. Use bilinear transformation.
-
-
6.
Design a Chebyshev IIR digital highpass filter for the following specifications:
-
3 dB cutoff frequency: 2000 Hz
-
Stopband cutoff frequency: 500 Hz
-
Stopband ripple: 10 dB
Assume a suitable sampling frequency. Use bilinear transformation.
-
-
7.
Using bilinear transformation, design a digital Chebyshev Type 1 Bandpass filter with the following specifications:
-
Lower passband edge frequency: 200 Hz
-
Upper passband edge frequency: 400 Hz
-
Lower stopband edge frequency: 100 Hz
-
Upper stopband edge frequency: 500 Hz
-
Passband ripple: 3 dB
-
Stopband ripple: 15 dB
Assume a suitable sampling frequency.
-
-
8.
Using bilinear transformation, design a digital bandstop Chebyshev Type 1 filter with the following specifications:
-
Lower passband edge frequency: 35 Hz
-
Upper passband edge frequency: 215 Hz
-
Lower stopband edge frequency: 100 Hz
-
Upper stopband edge frequency: 150 Hz
-
Passband ripple: 2 dB
-
Stopband ripple: 20 dB
Assume a suitable sampling frequency.
-
-
9.
Using bilinear transformation, design a digital bandstop elliptic filter with the following specifications:
-
Lower passband edge frequency: 800 Hz
-
Upper passband edge frequency: 2000 Hz
-
Lower stopband edge frequency: 1200 Hz
-
Upper stopband edge frequency: 1300 Hz
-
Passband ripple: 1 dB
-
Stopband ripple: 40 dB
Assume a suitable sampling frequency.
-
-
10.
A third-order lowpass IIR digital filter with passband edge frequency at \( 0.25\pi \) has a transfer function
$$ H(z) = \frac{{0.0662272z^{3} + 0.1987z^{2} + \, 0.1987z + 0.0662272}}{{z^{3} - 0.9356142z^{2} + 0.5671268z - 0.1015911 \, }} $$Design a lowpass filter with passband edge frequency at \( 0.375\pi \) by transforming the above transfer function using lowpass-to-lowpass digital-to digital transformation.
5.9 MATLAB Exercises
-
1.
Write a MATLAB program using the M-file impinvar to design a Type 1 Chebyshev IIR digital lowpass filter using the impulse-invariant method for the specifications given in Example 5.9.
-
2.
Write MATLAB code to design a Type 1 Chebyshev bandstop filter using bilinear transformation with the following specifications:
-
Lower passband edge: \( 0.3333\pi \)
-
Upper passband edge: \( 0.75\pi \)
-
Lower stopband edge: \( 0.45\pi \)
-
Upper stopband edge: \( 0.75\pi \)
-
Passband ripple: 1 dB
-
Stopband ripple: 40 dB
-
-
3.
Write a MATLAB program to design a highpass Butterworth filter using digital-to-digital transformation satisfying the following specifications:
-
Passband edge frequency: \( 0.5\pi \)
-
Stopband edge frequency: \( 0.4\pi \)
-
Passband ripple: 2 dB
-
Stopband ripple: 20 dB
-
-
4.
A third-order lowpass IIR digital filter with passband edge frequency at \( 0.25\pi \) has a transfer function
$$ H(z) = \frac{{0.0662272z^{3} + 0.1987z^{2} + \, 0.1987z + 0.0662272}}{{z^{3} - 0.9356142z^{2} + 0.5671268z - 0.1015911 \, }} $$Write MATLAB code to design a highpass filter with passband edge frequency at \( 0.45\pi \) by transforming the above transfer function using lowpass-to-highpass digital-to-digital transformation. Show the magnitude responses of the lowpass and highpass filters on the same plot.
-
5.
A first-order lowpass filter with passband edge frequency at 0.1667 \( \pi \) has a transfer function as
$$ H(z) = \frac{0.5z + 0.5}{z - 0.302 \, } $$Write MATLAB code to design a bandpass filter with lower passband edge frequency at \( 0.25\pi \) and upper passband edge frequency at \( 0.75\pi \) by transforming the above transfer function using lowpass-to-highpass digital transformation. Show the magnitude responses of the lowpass and bandpass filters.
-
6.
Write a MATLAB program to suppress a sinusoidal interference of 1750 Hz from an audio signal using a second-order IIR digital notch filter. Consider the audio signal ’DT.wav’ included in CD, and corrupt it by a sinusoidal signal of 1750 Hz. Implement the notch filter on it and comment on the results.
-
7.
Write a MATLAB program to generate artificial reverberations using the scheme (Fig. 5.31) with six IIR filters and four allpass reverberators as shown in Fig. 5.32, and with structures for IIR filters and allpass reverberators as shown in Fig. 5.32. Implement it with suitable delays and multiplier constants on the music sound ‘utopia.wav’ included in the CD and comment on the result.
-
8.
Write a MATLAB program for peaking equalizer consisting of three second-order IIR filters in cascade with different center frequencies, bandwidths, and DB gains for the filters. Implement it on the music sound ‘original.wav,’ and comment on the result.
References
G.C. Temes, S.K. Mitra (eds.), Modern Filter Theory and Design (Wiley, New York, 1973)
G.C. Temes, J.W. LaPatra, Introduction to Circuit Synthesis and Design (McGraw Hill, New York, 1977)
J. Vlach, Computerized Approximation and Synthesis of Linear Networks (Wiley, New York, 1969)
A. Antoniou, in Digital Filters Analysis, Design, and Applications (McGraw Hill Book Co., 2006)
R. Raut, M.N.S. Swamy, Modern Analog Filter Analysis and Design: A Practical Approach (Springer, VCH, 2010)
T.W. Parks, C.S. Burrus, Digital Filter Design (Wiley, New York, NY, 1987)
C.T. Chen, in Digital Signal Processing, Spectral Computation and Filter Design (Oxford University Press, New York, Oxford, 2001)
P.V.A. Mohan, V. Ramachandran, M.N.S. Swamy, Switched Capacitor Filters: Theory, Analysis and Design (Prentice Hall, London, 1995)
A.G. Constantinides, Proc. IEEE 117, 1585–1590, 170
R.E. Crochier, P. Penfield Jr., On the efficient design of bandpass digital filter structures. IEEE Trans. ASSP 23, 380–381 (1975)
R. Chassaing, in DSP Applications Using C and the TMS320C6x DSK (Wiley Interscience Publication, 2002)
E.C. Ifeachor, B.W. Jervis, in Digital Signal Processing—A Practical Approach (Prentice Hall, 2002)
L.B. Jackson, Digital Filters and Signal Processing (Kluwer Academic, Norwell, M.A., 1996)
P.A. Bernhardt, D.A. Antoniadis, A.V. Da Rosa, Lunar perturbations in columnar electron content and their interpretation in terms of dynamo electrostatic fields. J. Geophys. Res. (1976)
B.-J. Robert, in The Equivalence of Various Methods of Computing Biquad Coefficients for Audio Parametric Equalizers. Audio Engineering Society Conference, November 1994, paper # 3906
Audio Special Effects—Equalization and Artificial Reverberation, http://www.nd.ed
L. Tan, J. Jiang, in Digital Signal Processing Fundamentals and Applications (Elsevier, Academic Press 2nd, USA, edition, 2013)
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
Copyright information
© 2018 Springer Nature Singapore Pte Ltd.
About this chapter
Cite this chapter
Rao, K.D., Swamy, M.N.S. (2018). IIR Digital Filter Design. In: Digital Signal Processing. Springer, Singapore. https://doi.org/10.1007/978-981-10-8081-4_5
Download citation
DOI: https://doi.org/10.1007/978-981-10-8081-4_5
Published:
Publisher Name: Springer, Singapore
Print ISBN: 978-981-10-8080-7
Online ISBN: 978-981-10-8081-4
eBook Packages: Mathematics and StatisticsMathematics and Statistics (R0)