Keywords

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}} \)

Fig. 5.1
figure 1

Specifications of a lowpass analog filter

5.1.2 Butterworth Analog Lowpass Filter

The magnitude-square response of an \( N{\text{th}} \)-order analog lowpass Butterworth filter is given by

$$ \left| {H_{\text{a}} \left( {j\Omega } \right)} \right|^{2} = \frac{1}{{1 + \left( {\Omega /\Omega _{\text{c}} } \right)^{2N} }} $$
(5.1)

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

$$ \alpha = 10\,\log (1 + \left( {\Omega /\Omega _{\text{c}} } \right)^{2N} ) $$
(5.2)

For \( \Omega =\Omega _{\text{p}} , \) the passband attenuation is given by

$$ \alpha_{\text{p}} = 10\log (1 + \left( {\Omega _{\text{p}} /\Omega _{\text{c}} } \right)^{2N} ) $$
(5.3)

For \( \Omega =\Omega _{\text{s}} \), the stopband attenuation is

$$ \alpha_{\text{s}} = 10\log (1 + \left( {\Omega _{\text{s}} /\Omega _{\text{c}} } \right)^{2N} ) $$
(5.4)

Equations (5.3) and (5.4) can be rewritten as

$$ \left( {\Omega _{\text{p}} /\Omega _{\text{c}} } \right)^{2N} = 10^{{0.1\alpha_{\text{p}} }} - 1 $$
(5.5)
$$ \left( {\Omega _{\text{s}} /\Omega _{\text{c}} } \right)^{2N} = 10^{{0.1\alpha_{\text{s}} }} - 1 $$
(5.6)

From Eqs. (5.5) to (5.6), we obtain

$$ \left( {\Omega _{\text{s}} /\Omega _{\text{p}} } \right) = \left( {\frac{{10^{{0.1\alpha_{\text{s}} }} - 1}}{{10^{{0.1\alpha_{\text{p}} }} - 1}}} \right)^{1/2N} $$
(5.7)

Equation (5.7) can be rewritten as

$$ \log \left( {\Omega _{\text{s}} /\Omega _{\text{p}} } \right) = \frac{1}{2N}\log \left( {\frac{{10^{{0.1\alpha_{\text{s}} }} - 1}}{{10^{{0.1\alpha_{\text{p}} }} - 1}}} \right)^{{}} $$
(5.8)

From Eq. (5.8), solving for N we get

$$ N \ge \frac{{\log \left( {\frac{{10^{{0.1\alpha_{\text{s}} }} - 1}}{{10^{{0.1\alpha_{\text{p}} }} - 1}}} \right)}}{{2\log \left( {\Omega _{\text{s}} /\Omega _{\text{p}} } \right)}} $$
(5.9)

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

$$ H(s)H( - s) = \frac{1}{{1 + \left( { - s^{2} /\Omega _{\text{c}}^{2} } \right)^{N} }} $$
(5.10)

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

$$ 1 + \left( { - s^{2} } \right)^{N} = \prod\limits_{k = 1}^{2N} {\left( {s - s_{k} } \right)} $$
(5.11)

where

$$ s_{k} = \left\{ {\begin{array}{*{20}l} {{\text{e}}^{{j\left( {2k - 1} \right)\pi /\left( {2N} \right)}} } \hfill & {{\text{for}}\,n\,{\text{even}}} \hfill \\ {{\text{e}}^{{j\left( {k - 1} \right)\pi /N}} } \hfill & {{\text{for}}\,n\,{\text{odd}}} \hfill \\ \end{array} } \right. $$
(5.12)

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

$$ H_{N} (s) = \frac{1}{{\prod\nolimits_{l = 1}^{N} {\left( {s - p_{l} } \right)} }} $$
(5.13)

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

$$ s_{k} = \cos \left( {\frac{{\left( {2k - 1} \right)\pi }}{4}} \right) + j\sin \left( {\frac{{\left( {2k - 1} \right)\pi }}{4}} \right),\quad k = 1, \ldots , 2 $$

The poles in the left half of the s-plane are

$$ s_{2} = - \frac{1}{\sqrt 2 } + \frac{j}{\sqrt 2 };\quad s_{3} = - \frac{1}{\sqrt 2 } - \frac{j}{\sqrt 2 } $$

Hence,

$$ p_{1} = - \frac{1}{\sqrt 2 } + \frac{j}{\sqrt 2 };\quad p_{2} = - \frac{1}{\sqrt 2 } - \frac{j}{\sqrt 2 } $$

and

$$ H_{N} (s) = \frac{1}{{s^{2} + \sqrt 2 s + 1}} $$

In the case of N = 3,

$$ s_{k} = \cos \left( {\frac{{\left( {k - 1} \right)\pi }}{3}} \right) + j\sin \left( {\frac{{\left( {k - 1} \right)\pi }}{3}} \right), \quad k = 1, \ldots , 2 $$

The left half of s-plane poles are

$$ s_{3} = - \frac{1}{2} + \frac{j\sqrt 3 }{2};\quad s_{4} = - 1;\quad s_{5} = - \frac{1}{2} - \frac{j\sqrt 3 }{2}. $$

Hence

$$ p_{1} = - \frac{1}{2} + \frac{j\sqrt 3 }{2};\quad p_{2} = - 1;\quad p_{3} = - \frac{1}{2} - \frac{j\sqrt 3 }{2}. $$

and

$$ H_{N} (s) = \frac{1}{{\mathop {(s + 1)(s^{2} + s + 1)}\limits_{{}}^{{}} }} $$

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.

Table 5.1 List of normalized Butterworth polynomials

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.

Fig. 5.2
figure 2

Magnitude response of typical Butterworth lowpass filter

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 \)

$$ \log \left( {\frac{{10^{{0.1\alpha_{\text{s}} }} - 1}}{{10^{{0.1\alpha_{\text{p}} }} - 1}}} \right) = \log \left( {\frac{{10^{4} - 1}}{{10^{0.1} - 1}}} \right) = 4.5868. $$

Hence from Eq. (5.9),

$$ N \ge \frac{{{ \log }\left( {\frac{{10^{4} - 1}}{{10^{0.1} - 1}}} \right)}}{{2\,{ \log }\left( {5/1} \right)}} = \frac{4.5868}{1.3979} = 3.2811 $$

Since the order must be an integer, we choose N = 4.

The normalized lowpass Butterworth filter for N = 4 can be formulated as

$$ H_{N} (s) = \frac{1}{{(s^{2} + 0.76537s + 1)(s^{2} + 1.8477s + 1)}} $$

From Eq. (5.6), we have

$$ \Omega _{\text{c}} = \frac{{\Omega _{\text{s}} }}{{(10^{4} - 1)^{1/2N} }} = \frac{{10{,}000\pi }}{{(10^{4} - 1)^{1/8} }} = 9 9 3 5 $$

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) \)

$$ \begin{aligned} H_{a} (s) & = \frac{1}{{\left( {\frac{s}{ 9 9 3 5}} \right)^{2} + 0.76537\left( {\frac{s}{ 9 9 3 5}} \right) + 1}} \times \frac{1}{{\left( {\frac{s}{ 9 9 3 5}} \right)^{2} + 1.8477\left( {\frac{s}{ 9 9 3 5}} \right) + 1}} \\ & = \frac{{ 9. 7 4 2 5\times 10^{15} }}{{(s^{2} + 7. 6 0 4\times 10^{3} s + 9. 8 7 0 4 2 2 5\times 10^{7} )(s^{2} + 1. 8 3 5 7\times 10^{4} s + 9. 8 7 0 4 2 2 5\times 10^{7} )}} \\ \end{aligned} $$

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

$$ \left| {H(\Omega )} \right|^{2} = \frac{1}{{1 + \varepsilon^{2} T_{N}^{2} \left( {\Omega /\Omega _{\text{p}} } \right)}} $$
(5.14)

where \( T_{N} \left(\Omega \right) \) is the Chebyshev polynomial of order \( N \)

$$ T_{N} \left(\Omega \right) = \left\{ {\begin{array}{*{20}l} {\cos \left( {N\cos^{ - 1}\Omega } \right),} \hfill & {\left|\Omega \right| \le 1} \hfill \\ {\cosh \left( {N\cosh^{ - 1}\Omega } \right),} \hfill & {\left|\Omega \right| > 1} \hfill \\ \end{array} } \right. $$
(5.15)

The loss in dB in a Type 1 Chebyshev filter is given by

$$ \alpha = 10\log \left( {1 + \varepsilon^{2} T_{N}^{2} \left( {\Omega /\Omega _{\text{p}} } \right)} \right) $$
(5.16)

For \( \Omega =\Omega _{\text{p}} \), \( T_{N} \left(\Omega \right) = 1 \), and the passband attenuation is given by

$$ \alpha_{\text{p}} = 10\log (1 + \varepsilon^{2} ) $$
(5.17)

From Eq. (5.17), \( \varepsilon \) can be obtained as

$$ \varepsilon = \sqrt {10^{{0.1\alpha_{\text{p}} }} - 1} $$
(5.18)

For \( \Omega =\Omega _{\text{s}} \), the stopband attenuation is

$$ \alpha_{\text{s}} = 10{ \log }\left( {1 + \epsilon^{2} T_{n}^{2} \left( {\frac{{\Omega _{\text{s}} }}{{\Omega _{\text{p}} }}} \right)} \right) $$
(5.19)

Since \( (\Omega _{\text{s}} /\Omega _{\text{p}} ) > 1 \), the above equation can be written as

$$ \alpha_{\text{s}} = 10{ \log }\left[ {1 + \epsilon^{2} { \cosh }^{2} \left( {N\,{ \cosh }^{ - 1} \left( {\Omega _{\text{s}} /\Omega _{\text{p}} } \right)} \right)} \right] $$
(5.20)

Substituting Eq. (5.18) for \( \varepsilon \) in the above equation and solving for N, we get

$$ N \ge \frac{{\cosh^{ - 1} \sqrt {\frac{{10^{{0.1\alpha_{\text{s}} }} - 1}}{{10^{{0.1\alpha_{\text{p}} }} - 1}}} }}{{\cosh^{ - 1} \left( {\Omega _{\text{s}} /\Omega _{\text{p}} } \right)}} $$
(5.21)

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]

$$ x_{k} = - \sinh \left\{ {\frac{1}{N}{ \sinh }^{ - 1} \left( {\frac{1}{ \epsilon }} \right)} \right\} \cdot \sin \left\{ {\frac{{\left( {2k - 1} \right)\pi }}{2N}} \right\} ,\quad {\text{for}}\,k = 1,2,\ldots ,N $$
(5.22)
$$ y_{k} = \cosh \left\{ {\frac{1}{N}{ \sinh }^{ - 1} \left( {\frac{1}{\epsilon }} \right)} \right\}\cdot { \cos }\left\{ {\frac{{\left( {2k - 1} \right)\pi }}{2N}} \right\} ,\quad {\text{for}}\,k = 1,2,\ldots ,N $$
(5.23)

Also, the normalized transfer function is given by

$$ H_{N} \left( s \right) = \frac{{H_{0} }}{{\prod\nolimits_{k} {\left( {s - p_{k} } \right)} }} $$
(5.24)

where

$$ \begin{aligned} p_{k} & = - \sinh \left\{ {\frac{1}{N}{ \sinh }^{ - 1} \left( {\frac{1}{ \epsilon }} \right)} \right\} \cdot { \sin }\left\{ {\frac{{\left( {2k - 1} \right)\pi }}{2N}} \right\} \\ & \quad + j\,\cosh \left\{ {\frac{1}{N}{ \sinh }^{ - 1} \left( {\frac{1}{ \epsilon }} \right)} \right\} \cdot { \cos }\left\{ {\frac{{\left( {2k - 1} \right)\pi }}{2N}} \right\} \end{aligned} $$
(5.25a)

and

$$ H_{0} = \frac{1}{{2^{N - 1} }}\frac{1}{\varepsilon } $$
(5.25b)

As an illustration, consider the case of N = 2 with a passband ripple of 1 dB. From Eq. (5.18), we have

$$ \frac{1}{\varepsilon } = \frac{1}{{\sqrt {10^{{0.1\alpha_{\text{p}} }} - 1} }} = 1.965227 $$

Hence

$$ \sinh^{ - 1} \left( {\frac{1}{\varepsilon }} \right) = \sinh^{ - 1} (1.965227) = 1.428 $$

Therefore, from (5.25a), the poles of the normalized Chebyshev transfer function are given by

$$ \begin{aligned} p_{k} & = - \sinh \left( {0.714} \right){ \sin }\left\{ {\frac{{\left( {2k - 1} \right)\pi }}{4}} \right\} \\ & \quad + j\,\cosh \left( {0.714} \right){ \cos }\left\{ {\frac{{\left( {2k - 1} \right)\pi }}{4}} \right\},\quad k = 1,2 \\ \end{aligned} $$

Hence

$$ p_{1} = - 0.54887 + j0.89513,\quad p_{2} = - 0.54887 - j0.89513 $$

Also, from (5.25b), we have

$$ H_{0} = \frac{1}{2}\left( {1.965227} \right) = 0.98261 $$

Thus for N = 2, with a passband ripple of 1 dB, the normalized Chebyshev transfer function is

$$ H_{N} (s) = \frac{0.98261}{{(s - p_{1} )(s - p_{2} )}} = \frac{0.98261}{{(s^{2} + 1.098s + 1.103)}} $$

Similarly for N = 3, for a passband ripple of 1 dB, we have

$$ \begin{aligned} p_{k} & = - \sinh \left( {1.428/3} \right)\sin \frac{{\left( {2k - 1} \right)\pi }}{6} \\ & \quad + j\,\cosh \left( {1.428/3} \right)\cos \frac{{\left( {2k - 1} \right)\pi }}{6} ,\quad k = 1,2,3 \\ \end{aligned} $$

Thus,

$$ p_{1} = - 0.24709 + j0.96600;\quad p_{2} = - 0.49417;\quad p_{3} = - 0.24709 - j0.966. $$

Also, from (5.25b),

$$ H_{0} = \frac{1}{4}\left( {1.965227} \right) = 0.49131 $$

Hence, the normalized transfer function of Type 1 Chebyshev lowpass filter for N = 3 is given by

$$ \begin{aligned} H_{N} (s) & = \frac{0.49131}{{(s - p_{1} )(s - p_{2} )(s - p_{3} )}} \\ & = \frac{0.49131}{{(s^{3} + 0.988s^{2} + 1.238s + 0.49131)}} \\ \end{aligned} $$

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.

Table 5.2 List of normalized Type 1 Chebyshev transfer functions for passband ripple = 1 dB

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.

Fig. 5.3
figure 3

Magnitude response of typical Type 1 Chebyshev lowpass filter with 1 dB passband ripple

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 \)

$$ \cosh^{ - 1} \sqrt {\frac{{10^{{0.1\alpha_{\text{s}} }} - 1}}{{10^{{0.1\alpha_{\text{p}} }} - 1}}} = \cosh^{ - 1} \sqrt {\frac{{10^{4} - 1}}{{10^{0.1} - 1}}} = \cosh^{ - 1} (196.52) $$
$$ \cosh^{ - 1} \left( {\Omega _{\text{s}} /\Omega _{\text{p}} } \right) = \cosh^{ - 1} (5) = 2.2924 $$
$$ N \ge \frac{{{ \cosh }^{ - 1} \sqrt {\frac{{10^{4} - 1}}{{10^{0.1} - 1}}} }}{{{ \cosh }^{ - 1} \left( 5 \right)}} = 2.6059 $$

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

$$ H_{N} (s) = \frac{ 0. 4 9 1 3 1}{{s^{3} + 0.988s^{2} + 1.238s + 0.49131}} $$

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) \)

$$ \begin{aligned} H_{\text{a}} (s) & = \frac{ 0. 4 9 1 3 1}{{\left( {\frac{s}{2000\pi }} \right)^{3} + 0.988\left( {\frac{s}{2000\pi }} \right)^{2} + 1.238\left( {\frac{s}{2000\pi }} \right) + 0.49131}} \\ & = \frac{{ 1. 2 1 8 7\times 10^{11} }}{{s^{3} + 6. 2 0 9 9\times 10^{3} s^{2} + 4. 8 8 9\times 10^{7} s + 1. 2 1 8 7\times 10^{11} }} \\ \end{aligned} $$
  • 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

$$ \left| {H(\Omega )} \right|^{2} = \frac{1}{{1 + \varepsilon^{2} \left( {\frac{{T_{N}^{2} \left( {\Omega _{\text{s}} /\Omega _{\text{p}} } \right)}}{{T_{N}^{2} \left( {\Omega _{\text{s}} /\Omega } \right)}}} \right)}} $$
(5.26)

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 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]

$$ H_{N} \left( s \right) = \frac{{H_{0} \sum\nolimits_{k} {\left( {s - z_{k} } \right)} }}{{\sum\nolimits_{k} {\left( {s - p_{k} } \right)} }},\quad k = 1, 2, \ldots , N $$
(5.27)

where

$$ z_{k} = j\frac{1}{{{ \cos }\frac{{\left( {2k - 1} \right)\pi }}{N}}}\quad {\text{for}}\;\;k = 1, 2, \ldots , N $$
(5.28a)
$$ p_{k} = \frac{{\sigma_{k} }}{{\sigma_{k}^{2} +\Omega _{k}^{2} }} + j\frac{{\Omega _{k} }}{{\sigma_{k}^{2} +\Omega _{k}^{2} }}\quad {\text{for}}\;\;k = 1, 2, \ldots , N $$
(5.28b)
$$ \sigma_{k} = - \sinh \left\{ {\frac{1}{N}\sinh^{ - 1} \left( {\frac{1}{{\delta_{\text{s}} }}} \right)} \right\}\sin \frac{{\left( {2k - 1} \right)\pi }}{2N}\quad {\text{for}}\;\;k = 1, 2, \ldots , N $$
(5.28c)
$$ \Omega _{k} = \cosh \left\{ {\frac{1}{N}\sinh^{ - 1} \left( {\frac{1}{{\delta_{\text{s}} }}} \right)} \right\}\cos \frac{{\left( {2k - 1} \right)\pi }}{2N}\quad {\text{for}}\;\;k = 1, 2, \ldots , N $$
(5.28d)
$$ \delta_{\text{s}} = \frac{1}{{\sqrt {10^{{0.1\alpha_{\text{s}} }} - 1} }} $$
(5.28e)
$$ H_{0} = \frac{{\prod\nolimits_{k} {\left( { - z_{k} } \right)} }}{{\prod\nolimits_{k} {\left( { - p_{k} } \right)} }} $$
(5.28f)

For example, if we consider N = 3 with a stopband ripple of 40 dB, then from (5.28e),

$$ \frac{1}{{\delta_{\text{s}} }} = \sqrt {10^{{0.1\alpha_{\text{s}} }} - 1} = \sqrt {10^{4} - 1} = 99.995 $$

Hence,

$$ \sinh^{ - 1} \left( {\frac{1}{{\delta_{\text{s}} }}} \right) = 5.28829 $$

Using (5.28c) and (5.28d), we have

$$ \sigma_{k} = - \sinh \left( {5.28829/3} \right)\sin \frac{{\left( {2k - 1} \right)\pi }}{6}\quad {\text{for}}\;\;k = 1,2,3 $$
$$ \Omega _{k} = \cosh \left( {5.28829/3} \right)\cos \frac{{\left( {2k - 1} \right)\pi }}{6}\quad {\text{for}}\;\;k = 1,2,3 $$

Hence,

$$ \sigma_{1} = - 1.41927,\sigma_{2} = - 2.83854,\sigma_{3} = - 1.41927 $$
$$ \Omega _{1} = - 2.60387,\Omega _{2} = - 2.83854,\Omega _{3} = 2.60387 $$

Thus, from (5.28b), the poles are

$$ p_{1} = - 0.16115 + j0.29593,p_{2} = - 0.3523, p_{3} = - 0.16115 + j0.29593 $$

Also, using (5.28a), the zeros are given by

$$ z_{1} = - j(2/\sqrt {3)} , z_{2} = j(2/\sqrt {3)} $$

Finally, from (5.28f),

$$ H_{0} = 0.03 $$

Therefore, the normalized Type 2 Chebyshev lowpass filter for N = 3 with a stopband ripple of 40 dB is given by

$$ \begin{aligned} H_{N} (s) & = \frac{{0.03(s - z_{1} )(s - z_{2} )}}{{(s - p_{1} )(s - p_{2} )(s - p_{3} )}} \\ & = \frac{{0.03(s^{2} + 1.3333)}}{{(s^{3} + 0. 6 7 4 6s^{2} + 0. 2 2 7 0 9s + 0.04)}} \\ \end{aligned} $$

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.

Table 5.3 List of normalized Type 2 Chebyshev transfer functions for stopband ripple = 40 dB

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.

Fig. 5.4
figure 4

Magnitude response of typical Type 2 Chebyshev lowpass filter with 20 dB stopband ripple

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

$$ H_{N} \left( s \right) = \frac{{0.03\left( {s^{2} + 1.3333} \right)}}{{\left( {s^{3} + 0.6746s^{2} + 0.2271s + 0.04} \right)}} $$

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

$$ \begin{aligned} H_{\text{a}} (s) & = \frac{{0.03\left( {\frac{s}{{10{,}000\pi }}} \right)^{2} + 0.04}}{{\left( {\frac{s}{{10{,}000\pi }}} \right)^{3} + 0. 6 7 4 6\left( {\frac{s}{{10{,}000\pi }}} \right)^{2} + 0. 2 2 7 0 9\left( {\frac{s}{{10{,}000\pi }}} \right) + 0.04}} \\ & = \frac{{ 9. 4 2 5 2\times 10^{2} s^{2} { + 1} . 2 4 0 3\times 10^{12} }}{{s^{3} + 2. 1 1 9 3\times 10^{4} s^{2} + 2. 2 4 1 3\times 10^{8} s + 1. 2 4 0 3\times 10^{12} }} \\ \end{aligned} $$

5.1.4 Elliptic Analog Lowpass Filter

The square-magnitude response of an elliptic lowpass filter is given by

$$ \left| {H_{\text{a}} (j\Omega )} \right|^{2} = \frac{1}{{1 + \varepsilon^{2} U_{N}^{{}} \left( {\Omega /\Omega _{\text{p}} } \right)}} $$
(5.29)

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

$$ k = \frac{{\Omega _{\text{p}} }}{{\Omega _{\text{s}} }} $$
(5.30)

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]

$$ N \cong \frac{{\log \left( {16 \times \frac{{10^{{0.1\alpha_{\text{s}} }} - 1}}{{10^{{0.1\alpha_{\text{p}} }} - 1}}} \right)}}{{\log_{10} \left( {1/\rho } \right)}} $$
(5.31)

where \( \rho \) can be computed using

$$ \rho_{0} = \frac{{1 - \sqrt {k^{'} } }}{{2\left( {1 + \sqrt {k^{'} } } \right)}} $$
(5.32)
$$ k^{{\prime }} = \sqrt {1 - k^{2} } $$
(5.33)
$$ \rho = \rho_{0} + 2\left( {\rho_{0} } \right)^{5} + 15\left( {\rho_{0} } \right)^{9} + 150\left( {\rho_{0} } \right)^{13} $$
(5.34)

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.

Table 5.4 List of normalized elliptic transfer functions for passband ripple = 1 dB and stopband ripple = 40 dB

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.

Fig. 5.5
figure 5

Magnitude response of typical elliptic lowpass filter with 1 dB passband ripple and 30 dB stopband ripple

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

$$ k = \frac{{\Omega _{\text{p}} }}{{\Omega _{\text{s}} }} = \frac{2000\pi }{{10{,}000\pi }} = 0.2 $$

and

$$ k^{{\prime }} = \sqrt {1 - k^{2} } = \sqrt {1 - 0.04} = 0.979796. $$

Substituting these values in Eqs. (5.32) and (5.34), we get

$$ \rho_{0} = 0.00255135, $$
$$ \rho = 0.0025513525 $$

and hence

$$ N = \frac{{\log \left( {16 \times \frac{{10^{4} - 1}}{{10^{0.1} - 1}}} \right)}}{{\log_{10} \left( {\frac{1}{0.0025513525}} \right)}} = 2.2331. $$

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

$$ \begin{aligned} H_{\text{a}} (s) & = \frac{{0.0692\left( {\frac{s}{2000\pi }} \right)^{2} { + 0} . 5 2 6 5}}{{\left( {\frac{s}{2000\pi }} \right)^{3} + 0. 9 7 8 2 5\left( {\frac{s}{2000\pi }} \right)^{2} + 1. 2 4 3 4\left( {\frac{s}{2000\pi }} \right) + 0. 5 2 6 5}} \\ & = \frac{{ 4. 3 4 8\times 10^{2} s^{2} { + 1} . 3 0 6\times 10^{11} }}{{s^{3} + 6. 1 4 6 5\times 10^{3} s^{2} + 4. 9 0 8 7\times 10^{7} s + 1. 3 0 6\times 10^{11} }} \\ \end{aligned} $$

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]

$$ H_{\text{a}} \left( s \right) = \frac{1}{{a_{0} + a_{1} s + a_{2} s^{2} + \cdots + a_{N - 1} s^{N - 1} + a_{N} s^{N} }} $$
(5.35)

where the coefficients \( a_{N} \) are given by

$$ a_{n}^{{}} = \frac{(2N - n)!}{{2^{N - n} n!(N - n)!}} $$
(5.36)

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.

Fig. 5.6
figure 6

Magnitude responses of Bessel and Butterworth filters of order N = 3

Fig. 5.7
figure 7

Phase responses of Bessel and Butterworth filters of order N = 3

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.

Fig. 5.8
figure 8

Comparison of various types of analog lowpass filters a magnitude response and b phase 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.

Table 5.5 Comparison of orders of various types of filters

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

Fig. 5.9
figure 9

Lowpass-to-lowpass frequency transformation

$$ \Omega_\text{p} = 1,\Omega _\text{s} = \hat{\Omega }_\text{s} /\hat{\Omega }_\text{p}. $$
(5.37a)

Also, the transfer function HLP(\( \hat{s} \)) for these filters is related to the corresponding normalized transfer function \( H_{N} (s) \) by

$$ H_{\text{LP}} \left( {\hat{s}} \right) = H_{N} \left( s \right)_{{s = \frac{{\hat{s}}}{{\hat{\Omega }_\text{p}}}}} $$
(5.37b)

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

$$ H_{\text{LP}} \left( {\hat{s}} \right) = H_{N} \left( s \right)_{{s = \hat{s}/\hat{\Omega }_{\text{c}} }} $$
(5.37c)

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

$$ H_{LP} \left( {\hat{s}} \right) = H_{N} \left( s \right)_{{s = \hat{s}/\hat{\Omega }_{\text{s}} }} $$
(5.37d)
  • 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

$$ \Omega _\text{p} = 1,\Omega _\text{s} = \hat{\Omega }_\text{p} /\hat{\Omega }_\text{s} , $$
(5.38a)

and the desired transfer function HHP(\( \hat{s} \)) is related to the normalized lowpass transfer function \( H_{N} (s) \) by

$$ H_{\text{HP}} (\hat{s}) = \left. {H_{N} (s)} \right|_{{\text{s} = \hat{\Omega }_\text{p}/\hat{\text{s}}}} $$
(5.38b)
Fig. 5.10
figure 10

Lowpass-to-highpass frequency transformation

Equations (5.38a) and (5.38b) hold for all filters except for Butterworth and Type 2 Chebyshev filter. For Butterworth

$$ H_{\text{LP}} \left( {\hat{s}} \right) = H_{N} \left( s \right)_{{s = \hat{s}/\hat{\Omega }_{\text{c}} }} $$
(5.38c)
$$ H_{\text{HP}} (\hat{s}) = \left. {H_{N} (s)} \right|_{{s = \hat{\Omega }\text{p}/\hat{\text{s}}}} $$
(5.38d)

For Type 2 Chebyshev filter, the design equations are

$$ \Omega_\text{p} = \hat{\Omega }_{\text{s}} /\hat{\Omega }_{\text{p}} ,\Omega _\text{s} = 1 $$
(5.39a)

and

$$ H_{\text{HP}} \left( {\hat{s}} \right) = H_{N} \left( s \right)_{{s = \hat{\Omega }_{\text{s}} /\hat{s}}} $$
(5.39b)
  • 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.,

Fig. 5.11
figure 11

Lowpass-to-bandpass frequency transformation

$$ B_\text{p} = \hat{\Omega }_{\text{p2}} - \hat{\Omega }_{\text{p1}} $$
(5.40a)
$$ \hat{\Omega }_{\text{mp}} = \sqrt {\hat{\Omega }_{\text{p1}} \hat{\Omega }_{\text{p2}} } $$
(5.40b)

Now, consider the transformation

$$ s = \frac{{\left( {\hat{s}^{2} + \hat{\Omega }_{\text{mp}}^{2} } \right)}}{{B_\text{p} \hat{s}}} $$
(5.41)

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

$$ \Omega _{\text{s}}^{{\prime }} = \frac{{\hat{\Omega }_{\text{s1}}^{2} - \hat{\Omega }_{\text{p1}} \hat{\Omega }_{\text{p2}} }}{{\left( {\hat{\Omega }_{\text{p2}} - \hat{\Omega }_{\text{p1}} } \right)\hat{\Omega }_{\text{s1}} }} = A_{1} ({\text{say}}) $$
(5.42)

and

$$ \Omega _\text{s}^{{{\prime \prime }}} = \frac{{\hat{\Omega }_{\text{s2}}^{2} - \hat{\Omega }_{\text{p1}} \hat{\Omega }_{\text{p2}} }}{{\left( {\hat{\Omega }_{\text{p2}} - \hat{\Omega }_{\text{p1}} } \right)\hat{\Omega }_{\text{s2}}}} = A_{2} ({\text{say}}) $$
(5.43)

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)

$$ \Omega _{\text{p}} = 1,\,\Omega _{\text{s}} = { \hbox{min} }\left\{ {\left| {A_{1} } \right|,\left| {A_{2} } \right|} \right\} $$
(5.44a)

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

$$ \Omega _{\text{p}} = { \hbox{max} }\left\{ {1/\left| {A_{1} } \right|,1/\left| {A_{2} } \right|} \right\},\Omega _{\text{s}} = 1 $$
(5.44b)
  • 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

$$ s = \frac{{k\hat{s}}}{{\left( {\hat{s}^{2} + \hat{\Omega }_{\text{ms}}^{2} } \right)}} $$
(5.45)
Fig. 5.12
figure 12

Lowpass-to-bandstop frequency transformation

where \( \hat{\Omega}_{\text{ms}} \) is the geometric mean between the stopband edge frequencies of the bandstop filter, i.e.,

$$ \hat{\Omega }_{\text{ms}} = \sqrt {\hat{\Omega }_{\text{s1}} \hat{\Omega }_{\text{s2}} } $$
(5.46)

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,

$$ \Omega _\text{s} = \frac{k}{{\hat{\Omega }_{\text{s2}} - \hat{\Omega }_{\text{s1}} }} = \frac{k}{{B_\text{s}}} $$
(5.47a)

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

$$ - \frac{k}{{\hat{\Omega }_{\text{s2}} - \hat{\Omega }_{\text{s1}} }} = - \frac{k}{{B_\text{s} }} = -\Omega _\text{s} $$
(5.47b)

Hence, the constant k is given by

$$ k = B_\text{s}\Omega _\text{s} = \left( {\hat{\Omega }_{\text{s2}} - \hat{\Omega }_{\text{s1}} } \right)\Omega _\text{s} $$
(5.47c)

As a consequence, the passband edge frequencies \( \hat{\Omega }_{\text{p1}} \) and \( \hat{\Omega }_{\text{p2}} \) are transformed to

$$ \Omega _\text{p}^{{\prime }} = \frac{{\left( {\hat{\Omega }_{\text{s2}} - \hat{\Omega }_{\text{s1}} } \right)\hat{\Omega }_{p1} }}{{\hat{\Omega }_{\text{s1}} \hat{\Omega }_{\text{s2}} - \hat{\Omega }_{\text{p1}}^{2} }}\Omega _\text{s} = \frac{1}{{A_{1} }}\Omega _\text{s} $$
(5.48a)

and

$$ \Omega _\text{p}^{{{\prime \prime }}} = \frac{{\left( {\hat{\Omega }_{\text{s2}} - \hat{\Omega }_{\text{s1}} } \right)\hat{\Omega }_{\text{p2}} }}{{\hat{\Omega }_{\text{s1}} \hat{\Omega }_{\text{s2}} - \hat{\Omega }_{\text{p2}}^{2} }}\Omega _\text{s} = \frac{1}{{A_{2} }}\Omega _\text{s} $$
(5.48b)

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

$$ \Omega _{\text{p}} = 1,\,\Omega _{\text{s}} = { \hbox{min} }\left\{ {\left| {A_{1} } \right| , \left| {A_{2} } \right|} \right\} $$
(5.49a)

where

$$ A_{1} = \frac{{\hat{\Omega }_{\text{s1}} \hat{\Omega }_{\text{s2}} - \hat{\Omega }_{\text{p1}}^{2} }}{{\left( {\hat{\Omega }_{\text{s2}} - \hat{\Omega }_{\text{s1}} } \right)\hat{\Omega }_{p1 } }},A_{2} = \frac{{\hat{\Omega }_{\text{s1}} \hat{\Omega }_{\text{s2}} - \hat{\Omega }_{\text{p2}}^{2} }}{{\left( {\hat{\Omega }_{\text{s2}} - \hat{\Omega }_{\text{s1}} } \right)\hat{\Omega }_{\text{p2}} }} $$
(5.49b)

and the transfer function of the required bandstop filter is

$$ H_{\text{BS}} \left( {\hat{s}} \right) = H_{N} \left( s \right)_s = {{\frac{{\left( {\hat{\Omega }_{\text{s2}} - \hat{\Omega }_{\text{s1}} } \right)\Omega _\text{s} \hat{s}}}{{\hat{s}^{2} + \hat{\Omega }_{\text{s1}} \hat{\Omega }_{\text{s2}} }}}} $$
(5.49c)

For the Type 2 Chebyshev filter, Eq. (5.49a) would be replaced by

$$ \Omega _\text{p} = { \hbox{max} }\left\{ {1/\left| {A_{1} } \right|,1/\left| {A_{2} } \right|} \right\},{\Omega }_\text{s} = 1 $$
(5.50)

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.

Fig. 5.13
figure 13

Specifications of a digital lowpass filter

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

$$ \omega_{\text{p}} = \frac{{2\pi f_{\text{p}} }}{{F_{T} }} = 2\pi f_{\text{p}} T $$
(5.51a)
$$ \omega_{\text{s}} = \frac{{2\pi f_{\text{s}} }}{{F_{T} }} = 2\pi f_{\text{s}} T $$
(5.51b)

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:

  1. 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 .

  2. 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)
  3. 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)
  4. 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

$$ H(s) = \frac{1}{{(s + 1)(s^{2} + s + 1)}} $$
$$ H(s) = \frac{1}{s + 1} + \frac{ - 0.5 + 0.288j}{s + 0.5 + j0.866} + \frac{ - 0.5 - 0.288j}{s + 0.5 - j0.866} $$

Hence, from (5.55), we have

$$ \begin{aligned} H(z) & = \frac{1}{{1 - {\text{e}}^{ - 1} z^{ - 1} }} + \frac{ - 0.5 + j0.288}{{1 - {\text{e}}^{ - 0.5} {\text{e}}^{ - j0.866} z^{ - 1} }} + \frac{ - 0.5 - j0.288}{{1 - {\text{e}}^{ - 0.5} {\text{e}}^{j0.866} z^{ - 1} }} \\ & \text{ = }\frac{1}{{1 - 0.368z^{ - 1} }} + \frac{{ - 1 + 0.66z^{ - 1} }}{{1 - 0.786z^{ - 1} + 0.368z^{ - 2} }} \\ \end{aligned} $$

Example 5.6

Design a Butterworth filter using the impulse-invariant method for the following specifications:

$$ 0.8 \le \left| {H\left( {{\text{e}}^{j\omega } } \right)} \right| \le 1\quad \quad 0 \le \omega \le 0.2\pi $$
$$ \left| {H\left( {{\text{e}}^{j\omega } } \right)} \right| \le 0.2\quad \quad 0.6\pi \le \omega \le \pi $$

Solution

From (5.1), the magnitude-squared function of the Butterworth filter is

$$ \left| {H_{\text{a}} \left( {j\Omega } \right)} \right|^{2} = \frac{1}{{1 + \left( {\Omega /\Omega _{\text{c}} } \right)^{2N} }} $$

Substituting the requirements in the above magnitude function, we get

$$ 1 + \left( {\frac{0.2\pi }{{\Omega _{\text{C}} }}} \right)^{2N} = \left( {\frac{1}{0.8}} \right)^{2} $$
$$ 1 + \left( {\frac{0.6\pi }{{\Omega _{\text{C}} }}} \right)^{2N} = \left( {\frac{1}{0.2}} \right)^{2} $$

The solution of the above two equations leads to

$$ N = \frac{{\log \frac{24}{0.5625}}}{2\log 3} = \frac{ 1. 6 3 0 1}{ 0. 9 5 4 2} = 1.71 $$

Approximating to the nearest higher value, we have \( N = 2 \). Substituting N = 2 in

$$ 1 + \left( {\frac{0.2\pi }{{\Omega _{\text{C}} }}} \right)^{2N} = \left( {\frac{1}{0.8}} \right)^{2} $$

we get \( \Omega _{\text{c}} = 0.231\pi \). Also, for \( N = 2 \) the transfer function of the normalized Butterworth filter is

$$ H_{N} \left( s \right) = \frac{1}{{s^{2} + \sqrt 2 s + 1}} $$

Hence, from (5.37c),

$$ \begin{aligned} H_{\text{a}} \left( s \right) & = H_{N} \left( s \right)_{{s = s/\Omega _{\text{c}} }} \\ & = \frac{0.5266}{{s^{2} + 1.03s + 0.5266}} \\ & = \frac{0.516j}{s + 0.51 + j0.51} - \frac{0.516j}{s + 0.51 - j0.51} \\ \end{aligned} $$
$$ H(z) = \frac{0.516j}{{1 - {\text{e}}^{ - 0.51T} {\text{e}}^{ - j0.51T} z^{ - 1} }} - \frac{0.516j}{{1 - {\text{e}}^{ - 0.51T} {\text{e}}^{j0.51T} z^{ - 1} }} $$

Since T = 1, we have

$$ H\left( z \right) = \frac{{0.3019z^{ - 1} }}{{1 - 1.048z^{ - 1} + 0.36z^{ - 2} }} $$
  • Disadvantage of Impulse-Invariant Method

The frequency responses of the digital and analog filters are related by

$$ H\left( {{\text{e}}^{j\omega } } \right) = \frac{1}{T}\sum\limits_{k = - \infty }^{\infty } {H_{\text{a}} \left( {j\frac{\omega + 2\pi k}{T}} \right)} $$
(5.56)

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

$$ H_{\text{a}} \left( {j\frac{\omega }{T}} \right) = 0\quad \quad \left| {\frac{\omega }{T}} \right| = \left|\Omega \right| \ge \pi /T $$
(5.57)

then the digital filter frequency response is of the form

$$ H\left( {{\text{e}}^{j\omega } } \right) = \frac{1}{T}H_{\text{a}} \left( {j\frac{\omega }{T}} \right)\quad \left| \omega \right| \le \pi $$
(5.58)

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

$$ h\left( n \right) = T\,h_{\text{a}} \left( {nT} \right) $$
(5.59)

and \( H\left( z \right) \) would be

$$ H\left( z \right) = T\sum\limits_{k = 1}^{N} {\frac{{A_{k} }}{{1 - {\text{e}}^{{p_{k} T}} z^{ - 1} }}} $$
(5.60)

Also, the frequency response is

$$ H\left( {{\text{e}}^{j\omega } } \right) = \frac{1}{T}H_{\text{a}} \left( {j\frac{\omega }{T}} \right)\quad \left| \omega \right| \le \pi $$
(5.61)

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

$$ s = \frac{{\left( {z - 1} \right)}}{{\left( {z + 1} \right)}} $$
(5.62)

Then, a transfer function \( H_{\text{a}} \left( s \right) \) in the analog domain is transformed in the digital domain as

$$ H\left( z \right) = \left. { H_{\text{a}} \left( s \right)} \right|_{{s = \frac{{\left( {z - 1} \right)}}{{\left( {z + 1} \right)}}}} $$
(5.63)

Also, from (5.62) we have

$$ z = \frac{{\left( {1 + s} \right)}}{{\left( {1 - s} \right)}} $$
(5.64)

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

$$ \left| z \right| = \left| {\frac{{\left( {1 - \sigma + j\Omega } \right)}}{{\left( {1 + \sigma - j\Omega } \right)}}} \right| > 1 $$
(5.65)

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)

Fig. 5.14
figure 14

Mapping of the s-plane into the z-plane by the bilinear transformation

$$ s = \frac{{\left( {{\text{e}}^{j\omega } - 1} \right)}}{{\left( {{\text{e}}^{j\omega } + 1} \right)}} = j\,{ \tan }\frac{\omega }{2} $$
(5.66)

Thus

$$ \Omega = { \tan }\frac{\omega }{2} $$
(5.67)

or

$$ \omega = 2\,{ \tan }^{ - 1}\Omega $$
(5.68)

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:

Fig. 5.15
figure 15

Warping effect due to bilinear transformation

  1. Step 1

    From the digital filter specifications, prewarp the critical frequencies, such as the cutoff frequency, passband edge, stopband edge using Eq. (5.67).

  2. 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.

  3. 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

$$ \left| {H_{\text{a}} \left( {j\Omega } \right)} \right|^{2} = \frac{1}{{1 + \left( {\Omega /\Omega _{\text{c}} } \right)^{2N} }} $$

As bilinear transformation is used and \( \omega_{\text{c}} = 0.2\pi \), prewarping of the cutoff frequency yields

$$ \Omega _{\text{C}} = \tan \left( {\frac{0.2\pi }{2}} \right) = \tan (0.1\pi ) = 0.325 $$

From the magnitude response specification, we obtain

$$ 1 + \left( {\frac{{\tan \left( {0.4\pi /2} \right)}}{{\tan \left( {0.2\pi /2} \right)}}} \right)^{2N} = \left( {\frac{1}{0.317}} \right)^{2} $$

Solving the above equation gives N = 2. Hence,

$$ H_{\text{a}} \left( s \right) = \frac{{\Omega _{\text{c}}^{2} }}{{s^{2} + \sqrt 2\Omega _{\text{c}} s +\Omega _{\text{c}}^{2} }} $$

Thus,

$$ H_{\text{a}} \left( s \right) = \frac{0.10563}{{s^{2} + 0.46s + 0.10563}} $$

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). \)

$$ H\left( z \right) = \frac{{0.068(z + 1)^{2} }}{{z^{2} - 1.142z + 0.413}} $$

Example 5.8

Consider the following analog transfer function

$$ H_{\text{a}} (s) = \frac{{s^{2} - 3s + 3}}{{s^{2} + 3s + 3}} $$
  1. (i)

    Is it possible to obtain the corresponding digital transfer function using the impulse-invariant method?

  2. (ii)

    Is it possible to obtain the corresponding digital transfer function using bilinear transformation?

Solution

  1. (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),

$$ H\left( {{\text{e}}^{j\omega } } \right) = \frac{1}{T}\sum\limits_{k = - \infty }^{\infty } {H_{\text{a}} \left( {j\frac{\omega + 2\pi k}{T}} \right)} $$

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.

  1. (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.

$$ H\left( z \right) = \left. {H_{\text{a}} \left( s \right)} \right|_{{s = \left( {z - 1} \right)/\left( {z + 1} \right)}} $$

Example 5.9

Design a low pass IIR digital filter using the bilinear transformation for the following specifications:

$$ 0.9 \le \left| {H\left( {{\text{e}}^{j\omega } } \right)} \right| \le 1,\quad \quad 0 \le \omega \le 0.2\pi $$
$$ \left| {H\left( {{\text{e}}^{j\omega } } \right)} \right| \le 0.25,\quad \quad 0.3\pi \le \omega \le \pi $$

Solution

Prewarping the critical frequencies, we have the passband and stopband edge frequencies of the analog filter to be

$$ \Omega _{\text{p}} = \tan \left( {\frac{{0.2\,\uppi}}{2}} \right) = 0.325 $$
$$ \Omega _{\text{s}} = \tan \left( {\frac{{0.3\uppi}}{2}} \right) = 0.51 $$

Since

$$ \left| {H_{\text{a}} \left( {j\Omega } \right)} \right|^{2} = \frac{1}{{1 + \left( {\Omega /\Omega _{\text{c}} } \right)^{2N} }} $$

we have

$$ 1 + \left( {\frac{{\Omega _{\text{p}} }}{{\Omega _{\text{c}} }}} \right)^{2N} = 1 + \left( {\frac{0.325}{{\Omega _{\text{c}} }}} \right)^{2N} = \left( {\frac{1}{0.9}} \right)^{2} $$

and

$$ 1 + \left( {\frac{{\Omega _{\text{s}} }}{{\Omega _{\text{c}} }}} \right)^{2N} = 1 + \left( {\frac{0.51}{{\Omega _{\text{c}} }}} \right)^{2N} = \left( {\frac{1}{0.25}} \right)^{2} $$

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

$$ \begin{aligned} H_{\text{a}} \left( s \right) & = \frac{{\Omega _{\text{c}}^{5} }}{{\left( {s +\Omega _{\text{c}} } \right)\left( { s^{2} + 0.61803\Omega _{\text{c}} s +\Omega _{\text{c}}^{2} } \right) \left( { s^{2} + 1.61803\Omega _{\text{c}} s +\Omega _{\text{c}}^{2} } \right) }} \\ & = \frac{0.01}{{\left( {s + 0.398} \right)\left( { s^{2} + 0.246s + 0.1584} \right) \left( { s^{2} + 0.644s + 0.1584} \right) }} \\ \end{aligned} $$

Now substituting for s using Eq. (5.62), we get the required digital transfer function to be

$$ H\left( z \right) = \frac{{0.01\left( {z + 1} \right)}}{{\left( {1.398z - 0.602} \right)\left( {1.404z^{2} - 1.683 z + 0.9124} \right)\left( {1.802z^{2} - 1.683 z + 0.5144} \right)}} $$

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,

$$ \omega_{\text{c}} = \frac{{2\pi f_{\text{c}} }}{{F_{T} }} = \frac{2\pi \times 50}{500} = 0.2\pi $$
$$ \omega_{\text{s}} = \frac{{2\pi f_{\text{s}} }}{{F_{T} }} = \frac{2\pi \times 100}{500} = 0.4\pi $$

Prewarping of the above-normalized frequencies yields

$$ \Omega _{\text{C}} = \tan \left( {\frac{0.2\pi }{2}} \right) = \tan (0.1\pi ) = 0.325 $$
$$ \Omega _{\text{s}} = \tan \left( {\frac{0.4\pi }{2}} \right) = \tan (0.2\pi ) = 0.727 $$

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

$$ N = \frac{{\log \left( {10^{1} - 1} \right)}}{{2\log \left( {0.727/0.325} \right)}} = \frac{ 0. 9 5 4 2}{ 0. 6 9 9 3} = 1. 3 6 4 3. $$

Hence, the order of the Butterworth filter is 2. The normalized lowpass Butterworth filter for N = 2 is given by

$$ H_{N} (s) = \frac{1}{{\mathop {s^{2} + \sqrt 2 s + 1}\limits_{{}}^{{}} }} $$

The transfer function Hc(s) corresponding to \( \Omega _{\text{c}} = 0.325 \) is obtained by substituting

$$ s = \frac{\text{s}}{{\Omega _{\text{c}} }} = \frac{\text{s}}{0.325} $$

in the expression for H N (s); hence,

$$ H_{\text{a}} \left( s \right) = \frac{0.1056}{{s^{2} + 0.4595s + 0.1056}} $$

The digital transfer function H(z) of the desired filter is now obtained by using the bilinear transformation (5.52) in the above expression:

$$ \begin{aligned} & H\left( z \right) = \left. {H_{\text{c}} \left( s \right)} \right|_{{s = \frac{{\left( {z - 1} \right)}}{{\left( {z + 1} \right)}}}} \\ & H\left( z \right) = \frac{{0.1056z^{2} + 0.2112z + 0.1056}}{{1.5651z^{2} - 1.7888z + 0.646}} \\ \end{aligned} $$

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

$$ \omega_{\text{p}} = \frac{{2\pi f_{\text{p}} }}{{F_{T} }} = \frac{2\pi \times 1000}{8000} = 0.25\pi $$
$$ \omega_{\text{s}} = \frac{{2\pi f_{\text{s}} }}{{F_{T} }} = \frac{2\pi \times 3000}{8000} = 0.75\pi $$

By prewarping these frequencies, we get

$$ \hat{\Omega }_\text{p} = \tan \left( {\omega_\text{p} /2} \right) = 0. 4 1 4 2;\hat{\Omega }_\text{s} = \tan \left( {\omega_\text{s} /2} \right) = 2. 4 1 4 2. $$

For the prototype analog lowpass filter, we get

$$ \Omega _\text{p} = 1,\Omega _\text{s} = \hat{\Omega }_\text{s} /\hat{\Omega }_\text{p} = 2.4142/0.41422 = 5.8286,\alpha_\text{p} = 2\,\text{dB},\alpha_\text{s} = 20\,\text{dB} $$

Using these values, the order of the filter is computed using Eq. (5.9) as

$$ N \ge \frac{{{ \log }\left( {\frac{{10^{2} - 1}}{{10^{0.2} - 1}}} \right)}}{{2 { \log }\left( {\frac{5.8286}{1}} \right)}} = 1.4556 $$

Hence, we choose N = 2. The normalized lowpass Butterworth filter for N = 2 is given by

$$ H_{N} (s) = \frac{1}{{s^{2} + \sqrt 2 s + 1}} $$

Substituting the values of \( \hat{\Omega }_\text{s} \) and N in Eq. (5.6), we obtain

$$ \left( {2.4142/\hat{\Omega }_\text{c} } \right)^{4} = 10^{2} - 1 $$

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,

$$ H_{a} \left( s \right) = \frac{0.5858}{{s^{2} + 1.0824s + 0.5858}} $$

The digital transfer function H(z) of the desired filter is now obtained as

$$ H\left( z \right) = \left. {H_{\text{a}} \left( s \right)} \right|_{{s = \frac{{\left( {z - 1} \right)}}{{\left( {z + 1} \right)}}}} $$
$$ H\left( z \right) = \frac{{0.2195z^{2} + 0.439z + 0.2195}}{{z^{2} - 0.31047z + 0.1887}} $$

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

$$ \begin{aligned} \omega_{\text{p}} & = \frac{{2\pi f_{\text{p}} }}{{F_{T} }} = \frac{2\pi \times 1000}{10000} = 0.2\pi \\ \omega_{\text{s}} & = \frac{{2\pi f_{\text{s}} }}{{F_{T} }} = \frac{2\pi \times 3000}{10000} = 0.6\pi \\ \end{aligned} $$

By prewarping these frequencies, we get

$$ \hat{\Omega }_\text{p} = \tan \left( {\omega_\text{p} /2} \right) = 0.32492;\hat{\Omega }_\text{s} = \tan \left( {\omega_\text{s} /2} \right) = 1.3764. $$

For the prototype analog lowpass filter

$$ \Omega _\text{p} = 1,\Omega _\text{s} = \hat{\Omega }_\text{s} /\hat{\Omega }_\text{p} = 1.3764/0.32492 = 4.236, \alpha_\text{p} = 1\,\text{dB}, \alpha_\text{s} = 40\,\text{dB} $$

Hence from (5.21), we have

$$ N \ge \frac{{{ \cosh }^{ - 1} \sqrt {\frac{{10^{4} - 1}}{{10^{0.1} - 1}}} }}{{{ \cosh }^{ - 1} \left( {4.236} \right)}} = 2.45 $$

Hence, we choose N = 3. For N = 3, from Table 5.2, the normalized transfer function is given by

$$ H_{N} (s) = \frac{ 0. 4 9 1 3 1}{{s^{3} + 0.988s^{2} + 1.238s + 0.49131}} $$

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,

$$ H_{\text{a}} \left( s \right) = \frac{0.016849}{{s^{3} + 0.32099s^{2} + 0.13068s + 0.016849}} $$

The digital transfer function \( H_{\text{LP}} \left( z \right) \) of the desired lowpass filter is now obtained as

$$ H_{\text{LP}} \left( z \right) = \left. {H_{\text{a}} \left( s \right)} \right|_{{s = \frac{{\left( {z - 1} \right)}}{{\left( {z + 1} \right)}}}} $$
$$ H_{\text{LP}} \left( z \right) = \frac{{0.011474z^{3} + 0.034421z^{2} + 0.034421z + 0.011474}}{{z^{3} - 2.178z^{2} + 1.7698z + 0.53976}} $$

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

$$ H_{N} (s) = \frac{{0.03(s^{2} + 1.3333)}}{{(s^{3} + 0. 6 7 4 6s^{2} + 0. 2 2 7 0 9s + 0.04)}} $$

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,

$$ H_{\text{a}} \left( s \right) = \frac{{0.041292s^{2} + 0.10430}}{{s^{3} + 0.92852s^{2} + 0.43022s + 0.10430}} $$

The digital transfer function \( H_{\text{LP}} \left( z \right) \) of the desired lowpass filter is now obtained as

$$ H\left( z \right) = \left. {H_{\text{a}} \left( s \right)} \right|_{{s = \frac{{\left( {z - 1} \right)}}{{\left( {z + 1} \right)}}}} $$
$$ H_{\text{LP}} \left( z \right) = \frac{{0.059111z^{3} + 0.11028z^{2} + 0.11028z + 0.059111}}{{z^{3} - 1.2933z^{2} + 0.7934z - 0.16134}} $$

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

$$ \omega_{\text{p}} = \frac{2\pi \times 800}{4000} = 0.4\pi $$
$$ \omega_{\text{s}} = \frac{2\pi \times 1600}{4000} = 0.8\pi $$

Prewarping these frequencies, we get

$$ \hat{\Omega }_\text{p} = \tan \left( {\omega_\text{p} /2} \right) = 0.72654;\hat{\Omega }_\text{s} = \tan \left( {\omega_\text{s} /2} \right) = 3.0777. $$

For the prototype analog lowpass filter

$$ \Omega _\text{p} = 1,\Omega _\text{s} = \hat{\Omega }_\text{s} /\hat{\Omega }_\text{p} = 4.236,\quad \alpha_\text{p} = 1\,\text{dB},\quad \alpha_\text{s} = 40\,\text{dB} $$
$$ k = \frac{{\Omega _{\text{p}} }}{{\Omega _{\text{s}} }} = \frac{0.72654}{3.0777} = 0.23607 $$
$$ k^{{\prime }} = \sqrt {1 - k^{2} } = 0.97174 $$
$$ \rho_{0} = \frac{{1 - \sqrt {k^{{\prime }} } }}{{2\left( {1 + \sqrt {k^{{\prime }} } } \right)}} = 0.0035837 $$
$$ \rho = \rho_{0} + 2\left( {\rho_{0} } \right)^{5} + 15\left( {\rho_{0} } \right)^{9} + 150\left( {\rho_{0} } \right)^{13} = 0.0035837 $$
$$ N \cong \frac{{\log \left( {16 \times \frac{{10^{{0.1\alpha_{s} }} - 1}}{{10^{{0.1\alpha_{p} }} - 1}}} \right)}}{{\log_{10} \left( {1/\rho } \right)}} = 2.3678 $$

Hence, we choose N = 3. For N = 3, from Table 5.4, the normalized transfer function is

$$ H_{N} \left( s \right) = \frac{{0.0692s^{2} + 0.5265}}{{s^{3} + 0.9782s^{2} + 1.2434s + 0.5265}} $$

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,

$$ H_{\text{a}} (s) = \frac{{0.050277s^{2} + 0.10430}}{{s^{3} + 0.7107s^{2} + 0.65634s + 0.20192}} $$

The digital transfer function \( H_{\text{LP}} \left( z \right) \) of the desired lowpass filter is now obtained as

$$ H_{\text{LP}} \left( z \right) = \left. {H_{\text{a}} \left( s \right)} \right|_{{s = \frac{{\left( {z - 1} \right)}}{{\left( {z + 1} \right)}}}} $$
$$ H_{\text{LP}} \left( z \right) = \frac{{0.09817z^{3} + 0.21622z^{2} + 0.21622z + 0.09817}}{{z^{3} - 0.95313z^{2} + 0.87143z - 0.2895}} $$

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

$$ \omega_{\text{s}} = \frac{2\pi \times 25}{100} = 0.5\pi $$
$$ \omega_{\text{p}} = \frac{2\pi \times 40}{100} = 0.8\pi $$

Prewarping these frequencies, we get

$$ \begin{aligned} \hat{\Omega }_\text{p} & = \tan \left( {\omega_\text{p} /2} \right) = 3. 0 7 7 7\\ \hat{\Omega }_\text{s} & = \tan \left( {\omega_\text{s} /2} \right) = 1.0 \\ \end{aligned} $$

For the prototype analog lowpass filter, we have

$$ \Omega _\text{p} = 1,\Omega _\text{s} = \hat{\Omega }_\text{p} /\hat{\Omega }_\text{s} = 3.0777, \alpha_\text{p} = 1\,\text{dB}, \alpha_\text{s} = 20\,\text{dB} $$

Substituting these values in Eq. (5.9), the order of the filter is given by

$$ N \ge \frac{{{ \log }\left( {\frac{{10^{2} - 1}}{{10^{0.1} - 1}}} \right)}}{{2 { \log }\left( {\frac{3.077}{1}} \right)}} = 2.6447 $$

Hence, we choose N = 3. From Table 5.1, the third-order normalized Butterworth lowpass filter transfer function is given by

$$ H_{N} \left( s \right) = \frac{1}{{\left( {s + 1} \right)\left( {s^{2} + s + 1} \right)}} $$

Substituting the values of \( \Omega _{\text{s}} \) and N in Eq. (5.6), we obtain

$$ \left( {\frac{3.0777}{{\Omega _{c} }}} \right)^{6} = 10^{2} - 1 $$

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,

$$ H_{\text{LP}} (s) = \frac{2.93}{{s^{3} + 2.8619s^{2} + 4.0952s + 2. 9 3}} $$

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} \)

$$ H_{\text{HP}} (s) = \frac{{s^{3} }}{{s^{3} + 4.3017s^{2} + 9.2521s + 9. 9 4 9 9}} $$

The digital transfer function of the required highpass filter is obtained by using the bilinear transformation:

$$ H_{\text{HP}} \left( z \right) = \left. {H_{\text{HP}} \left( s \right)} \right|_{{s = \frac{z - 1}{z + 1}}} $$

Thus,

$$ H_{\text{HP}} (z) = \frac{{0.0408z^{3} - 0.1224z^{2} + 0.1224z - 0.0408}}{{z^{3} + 1.2978z^{2} + 0.7875z + 0.1632}} $$

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

$$ \omega_{\text{s}} = \frac{2\pi \times 500}{2000} = 0.5\pi ;\quad \omega_{\text{p}} = \frac{2\pi \times 700}{2000} = 0.7\pi $$

Prewarping these frequencies, we get

$$ \hat{\Omega }_\text{p} = { \tan }\left( {\omega_\text{p} /2} \right) = 1.9626105,\hat{\Omega }_\text{s} = { \tan }\left( {\omega_\text{s} /2} \right) = 1 $$

For the prototype analog lowpass filter

$$ \Omega _\text{p} = 1,\Omega _\text{s} = \hat{\Omega }_\text{p} /\hat{\Omega }_\text{s} = 1.9626105, \alpha_\text{p} = 1\,\text{dB}, \alpha_\text{s} = 40\,\text{dB} $$

Substituting these values in Eq. (5.21), the order of the filter is given by

$$ N \ge \frac{{{ \cosh }^{ - 1} \sqrt {\frac{{10^{4} - 1}}{{10^{0.1} - 1}}} }}{{{ \cosh }^{ - 1} \left( {1.9626} \right)}} = 4.6127 $$

Hence, we choose N = 5. From (5.18), we have

$$ \frac{1}{\varepsilon } = \frac{1}{{\sqrt {10^{{0.1\alpha_{\text{p}} }} - 1} }} = 1.965227 $$
$$ \sinh^{ - 1} \left( {\frac{1}{\varepsilon }} \right) = \sinh^{ - 1} (1.965227) = 1.428 $$

Using Eqs. (5.24) and (5.25a, 5.25b), the normalized transfer function is given by

$$ H_{N} \left( s \right) = \frac{{H_{0} }}{{\prod\nolimits_{k} {\left( {s - p_{k} } \right)} }} $$

where

$$ \begin{aligned} p_{k} & = - \sinh \left\{ {\frac{1}{N}{ \sinh }^{ - 1} \left( {\frac{1}{ \epsilon }} \right)} \right\} \cdot { \sin }\left\{ {\frac{{\left( {2k - 1} \right)\pi }}{2N}} \right\} \\ & \quad + j\,\cosh \left\{ {\frac{1}{N}{ \sinh }^{ - 1} \left( {\frac{1}{ \epsilon }} \right)} \right\} \cdot { \cos }\left\{ {\frac{{\left( {2k - 1} \right)\pi }}{2N}} \right\} \end{aligned} $$

and

$$ H_{0} = \frac{1}{{2^{N - 1} }}\frac{1}{\varepsilon } $$

Substituting N = 5 and k = 1, 2, 3, 4, 5 in the above equations, we get

$$ p_{1,5} = - 0.08946 \pm j 0.99014,\quad p_{2,4} = - 0.23421 \pm j 0.61194,\quad p_{3} = - 0.2895 $$

and

$$ H_{0} = 0.12283 $$

Hence,

$$ H_{N} \left( s \right) = \frac{ 0. 1 2 2 8 3}{{s^{5} + 0. 9 3 6 8 2s^{4} + 1. 6 8 8 8s^{3} + 0. 9 7 4 4s^{2} + 0. 5 8 0 5 3 {\text{s + 0}} . 1 2 2 8 3}} $$

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); \)

$$ H_{\text{HP}} (s) = \frac{{0.12283s^{5} }}{{s^{5} + 9.2762s^{4} + 30.557s^{3} + 103.94s^{2} + 113.16s + 237.07}} $$

The digital transfer function of the highpass filter can be obtained by using bilinear transformation:

$$ H_{\text{HP}} \left( z \right) = \left. {H_{\text{HP}} \left( s \right)} \right|_{{s = \frac{z - 1}{z + 1}}} $$

Thus,

$$ H_{HP} (z) = \frac{{0.0020202z^{5} - 0.010101{\text{z}}^{4} + 0.020202{\text{z}}^{3} - 0.020202{\text{z}}^{2} + 0.010101{\text{z}} - 0.0020202}}{{z^{5} + 3.1624{\text{z}}^{4} + 4.7607{\text{z}}^{3} + 4.0528{\text{z}}^{2} + 1.9344z + 0.41529}} $$

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

$$ \omega_{{{\text{p}}1}} = 0.2\pi , \omega_{{{\text{p}}2}} = 0.4\pi , \omega_{{{\text{s}}1}} = 0.1\pi , \omega_{{{\text{s}}2}} = 0.5\pi $$

The prewarped analog frequencies are given by

$$ \begin{array}{*{20}l} {\hat{\Omega }_{\text{p1}} = { \tan }\left( {\omega_{\text{p1}} /2} \right) = \tan \left( {\pi /10} \right) = 0.325} \hfill \\ {\hat{\Omega }_{\text{p2}} = { \tan }\left( {\omega_{\text{p2}} /2} \right) = \tan \left( {\pi /5} \right) = 0.7265} \hfill \\ {\hat{\Omega }_{\text{s1}} = { \tan }\left( {\omega_{\text{s1}} /2} \right) = \tan \left( {\pi /20} \right) = 0.1584} \hfill \\ {\hat{\Omega }_{\text{s2}} = { \tan }\left( {\omega_{\text{s2}} /2} \right) = \tan \left( {\pi /4} \right) = 1} \hfill \\ \end{array} $$

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

$$ A_{1} = \frac{{\hat{\Omega }_{\text{s1}}^{2} - \hat{\Omega }_{\text{p1}} \hat{\Omega }_{\text{p2}} }}{{\left( {\hat{\Omega }_{\text{p2}} - \hat{\Omega }_{\text{p1}} } \right)\hat{\Omega }_{\text{s1}} }} = 1.90258 $$

and

$$ A_{2} = \frac{{\hat{\Omega }_{\text{s2}}^{2} - \hat{\Omega }_{\text{p1}} \hat{\Omega }_{\text{p2}} }}{{\left( {\hat{\Omega }_{\text{p2}} - \hat{\Omega }_{\text{p1}} } \right)\hat{\Omega }_{s2} }} = - 3.318 $$

Now using (5.44a), we get the specifications for the normalized analog lowpass filter to be

$$ \begin{aligned}\Omega _{\text{p}} & = 1,\Omega _{\text{s}} = { \hbox{min} }\left\{ {\left| {A_{1} } \right|, \left| {A_{2} } \right|} \right\} = 1.90258, \\ \alpha_{\text{p}} & = 2 \,{\text{dB}},\alpha_{\text{s}} = 20\,{\text{dB}} \\ \end{aligned} $$

Substituting these values in Eq. (5.9), the order of the filter is given by

$$ N \ge \frac{{{ \log }\left( {\frac{{10^{2} - 1}}{{10^{0.2} - 1}}} \right)}}{{ 2\,{ \log }\left( {1.90258} \right)}} = 3.9889 $$

We choose N = 4. The transfer function of the fourth-order normalized Butterworth lowpass filter is given by

$$ H_{N} (s) = \frac{1}{{s^{4} + 2.6131s^{3} + 3.4142s^{2} + 2.6131s + 1}} $$

Substituting the values of \( \Omega _{\text{s}} \) and N in Eq. (5.6), we obtain

$$ \left( {\frac{1.90258}{{\Omega _{\text{c}} }}} \right)^{8} = 10^{2} - 1 $$

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} \)

$$ H_{\text{LP}} (s) = \frac{1.3169}{{s^{4} + 2.7993s^{3} + 3.9180s^{2} + 3.2124s + 1.3169}} $$

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

$$ s = \frac{{s^{2} + \hat{\Omega }_{\text{p1}} \hat{\Omega }_{\text{p2}} }}{{\left( {\hat{\Omega }_{\text{p2}} - \hat{\Omega }_{\text{p1}} } \right)s}} = \frac{{s^{2} + 0.236}}{0.402\,s} $$

to obtain

$$ \begin{aligned} & H_{\text{BP}} \left( s \right) \\ & = \frac{{0.0344s^{4} }}{{s^{8} + 1.1253s^{7} + 1.5772 \, s^{6} + 1.0054s^{5} + 0.6674s^{4} + 0.2373s^{3} + 0.0878s^{2} + 0.0148s + 0.0031}} \\ \end{aligned} $$

The digital bandpass filter is now obtained by using the bilinear transformation in the above expression. Thus,

$$ H_{\text{BP}} \left( z \right) = \frac{{z^{8} - 0.0241z^{6} + 0.0361z^{4} - 0.0241z^{2} + 0.0060}}{{z^{8} - 3.8703z^{7} + 7.9661z^{6} - 10.6337z^{5} + 10.0678z^{4} - 6.8080z^{3} + 3.3529z^{2} - 1.002z + 0.1666}} $$

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

$$ \Omega _{\text{p}} = 1,\,\Omega _{\text{s}} = \hbox{min} \left\{ {\left| {A_{1} } \right|, \left| {A_{2} } \right|} \right\} = 1.90258,\alpha_{\text{p}} = 1\,{\text{dB}},\alpha_{\text{s}} = 10\,{\text{dB}} $$

Substituting these values in Eq. (5.21), the order of the filter is given as

$$ N \ge \frac{{{ \cosh }^{ - 1} \sqrt {\frac{{10^{1} - 1}}{{10^{0.1} - 1}}} }}{{{ \cosh }^{ - 1} \left( {1.90258} \right)}} = 1.9544 $$

We choose N = 2. From (5.18), we have

$$ \frac{1}{\varepsilon } = \frac{1}{{\sqrt {10^{{0.1\alpha_{\text{p}} }} - 1} }} = 1.965227 $$
$$ \sinh^{ - 1} \left( {\frac{1}{\varepsilon }} \right) = \sinh^{ - 1} (1.965227) = 1.428 $$

Using Eqs. (5.25a) and (5.25b), the poles of the normalized lowpass transfer function are given by

$$ p_{k} = - \sinh \left( {0.714} \right){ \sin }\left\{ {\frac{{\left( {2k - 1} \right)\pi }}{4}} \right\} + j\,\cosh \left( {0.714} \right){ \cos }\left\{ {\frac{{\left( {2k - 1} \right)\pi }}{4}} \right\} ,\quad k = 1,2 $$

and

$$ H_{0} = \frac{1}{2}\frac{1}{\varepsilon } = 0.9826 $$

Hence,

$$ p_{1,2} = - 0.54887 \pm j\,0.89513 $$

Thus for N = 2, with a passband ripple of 1 dB, the normalized transfer function is

$$ H_{N} \left( s \right) = \frac{0.9826}{{s^{2} + 1.0977s + 1.1025}} $$

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

$$ s = \frac{{s^{2} + \hat{\Omega }_{\text{p1}} \hat{\Omega }_{\text{p2}} }}{{\left( {\hat{\Omega }_{\text{p2}} - \hat{\Omega }_{\text{p1}} } \right)s}} = \frac{{s^{2} + 0.236}}{0.402s} $$

to obtain

$$ H_{\text{BP}} \left( z \right) = \frac{{0.1584s^{2} }}{{(s^{4} + 0.4407s^{3} + 0.6497\,s^{2} + 0.1040\,s + 0.0557)}} $$

We now use the bilinear transformation in the above to obtain the required digital bandpass filter transfer function as

$$ H_{\text{BP}} (z) = \frac{{0.0704z^{4} - \, 0.1408 \, z^{2} + 0.0704}}{{z^{4} - 1.9779 \, z^{3} + \, 2.2375 \, z^{2} - 1.3793 \, z + 0.5158}} $$

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

$$ \omega_{{{\text{p}}1}} = 0.14\pi , \omega_{{{\text{p}}2}} = 0.86\pi , \omega_{{{\text{s}}1}} = 0.4\pi , \omega_{{{\text{s}}2}} = 0.6\pi $$

The prewarped analog frequencies are given by

$$ \hat{\Omega }_{\text{p1}} = { \tan }\left( {\omega_{\text{p1}} /2} \right) = \tan \left( {0.14\pi /2} \right) = 0.2235 $$
$$ \hat{\Omega }_{\text{p2}} = { \tan }\left( {\omega_{\text{p2}} /2} \right) = \tan \left( {0.86\pi /2} \right) = 4.4737 $$
$$ \hat{\Omega }_{\text{s1}} = { \tan }\left( {\omega_{\text{s1}} /2} \right) = \tan \left( {0.4\pi /2} \right) = 0.7265 $$
$$ \hat{\Omega }_{\text{s2}} = \tan \left( {\frac{{\omega_{\text{s2}} }}{2}} \right) = \tan \left( {\frac{0.6\pi }{2}} \right) = 1.3764 $$

We now obtain the corresponding specifications for the normalized analog lowpass filter using the lowpass-to-bandstop transformation. From Eq. (5.49b), we have

$$ A_{1} = \frac{{\hat{\Omega }_{\text{s1}} \hat{\Omega }_{\text{s2}} - \hat{\Omega }_{\text{p1}}^{2} }}{{\left( {\hat{\Omega }_{\text{s2}} - \hat{\Omega }_{\text{s1}} } \right)\hat{\Omega }_{\text{p1}} }} = 6.5403,A_{2} = \frac{{\hat{\Omega }_{\text{s1}} \hat{\Omega }_{\text{s2}} - \hat{\Omega }_{\text{p2}}^{2} }}{{\left( {\hat{\Omega }_{\text{s2}} - \hat{\Omega }_{\text{s1}} } \right)\hat{\Omega }_{\text{p2}} }} = - 6.5397 $$

Now using (5.49a), we get the specifications for the normalized analog lowpass filter to be

$$ \Omega _{\text{p}} = 1,\Omega _{\text{s}} = \hbox{min} \left\{ {\left| {A_{1} } \right|, \left| {A_{2} } \right|} \right\}, \alpha_{\text{p}} = 3\,{\text{dB}}, \alpha_{\text{s}} = 15\,{\text{dB}} $$

Substituting these values in Eq. (5.9), the order of the filter is given by

$$ N \ge \frac{{{ \log }\left( {\frac{{10^{1.5} - 1}}{{10^{0.3} - 1}}} \right)}}{{2 { \log }\left( {6.5397} \right)}} = 0.9125 $$

We choose \( N = 1 \). The transfer function of the first-order normalized Butterworth lowpass filter is

$$ H_{N} (s) = \frac{1}{(s + 1)} $$

Substituting the values of \( \Omega _{\text{s}} \) and N in Eq. (5.6), we obtain

$$ \left( {\frac{6.5397}{{\Omega _{\text{c}} }}} \right)^{2} = 10^{1.5} - 1 $$

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} \)

$$ H_{\text{LP}} (s) = \frac{ 1. 1 8 1 8}{{{{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

$$ s = \frac{{\left( {\hat{\Omega }_{\text{s2}} - \hat{\Omega }_{\text{s1}} } \right)\Omega _\text{s} s}}{{s^{2} + \hat{\Omega }_{\text{s1}} \hat{\Omega }_{\text{s2}} }} = \frac{{\left( {0.6499} \right)\left( {6.5397} \right)s}}{{s^{2} + 1}} = \frac{4.25\,s}{{s^{2} + 1}} $$

to obtain

$$ H_{\text{BS}} \left( s \right) = \frac{{s^{2} + 1}}{{s^{2} + 3.5964s + 1}} $$

The transfer function of the required digital bandstop filter is now obtained by using the bilinear transformation:

$$ \begin{aligned} & \left. {H_{\text{BS}} (z) = H_{\text{BS}} (s)} \right|_{{s = \frac{z - 1}{z + 1}}} \\ & \quad \quad \quad = \frac{{0.3574z^{2} + 0.3574}}{{z^{2} - 0.2853}} \\ \end{aligned} $$

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

$$ \omega_{\text{s}} = \frac{2\pi \times 500}{2000} = 0.5\pi ;\quad \omega_{\text{p}} = \frac{2\pi \times 700}{2000} = 0.7\pi $$

Prewarping these frequencies, we get

$$ \hat{\Omega }_\text{p} = \tan \left( {\frac{{\omega_\text{p} }}{2}} \right) = 1.9626105,\hat{\Omega }_{\text{s1}} = \tan \left( {\frac{{\omega_\text{s} }}{2}} \right) = 1 $$

For the prototype analog lowpass filter

$$ \Omega _\text{p} = 1,\Omega _\text{s} = \hat{\Omega }_\text{p} /\hat{\Omega }_\text{s} = 1.9626105, \alpha_\text{p} = 1\,\text{dB}, \alpha_\text{s} = 40\,\text{dB} $$

From (5.30) and (5.32) to (5.34), we get

$$ \begin{aligned} k & = \frac{{\Omega _{\text{p}} }}{{\Omega _{\text{s}} }} = \frac{1}{1.9626105} = 0.5095;\quad k^{{\prime }} = \sqrt[{}]{{1 - k^{2} }} = 0.8605; \\ \rho_{0} & = \frac{{1 - \sqrt {k^{{\prime }} } }}{{2\left( {1 + \sqrt {k^{{\prime }} } } \right)}} = 0.0188 \\ \rho & = \rho_{0} + 2\left( {\rho_{0} } \right)^{5} + 15\left( {\rho_{0} } \right)^{9} + 150\left( {\rho_{0} } \right)^{13} = 0. 0 1 8 8\\ \end{aligned} $$

Substituting these values in Eq. (5.31), the order of the filter is given by

$$ N \cong \frac{{\log \left( {16 \times \frac{{10^{{0.1\alpha_{\text{s}} }} - 1}}{{10^{{0.1\alpha_{\text{p}} }} - 1}}} \right)}}{{\log_{10} \left( {1/\rho } \right)}} = \frac{{\log_{10} \left( {16 \times \frac{{10^{4} - 1}}{{10^{0.1} - 1}}} \right)}}{{\log_{10} \left( {1/ 0. 0 1 8 8} \right)}} = 3.3554 $$

Let us choose \( N = 4 \). Then from Table 5.4, we have

$$ H_{N} (s) = \frac{{0.01s^{4} + 0.1502s^{2} + 0.3220}}{{s^{4} + 0.9391s^{3} + 1.5137s^{2} + 0.8037s + 0.3612}} $$

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) \)

$$ H_{\text{HP}} (s) = \frac{{ 0. 3 2 2 {\text{s}}^{4} + 0.5785s^{2} + { 0} . 1 4 8 4}}{{0.3612s^{4} + 1.5774s^{3} + 5.8305s^{2} + 7.0993s + 14.8367}} $$

Then, the required highpass filter in the digital domain is given by

$$ \left. {H_{\text{HP}} (z)\text{ = }H_{\text{HP}} (s)} \right|_{{s = \frac{z - 1}{z + 1}}} $$
$$ H_{\text{HP}} (z) = \frac{{0.035z^{4} - 0.0234z^{3} + \, 0.0561z^{2} - 0.0234z + 0.035}}{{z^{4} + 2.321z^{3} + 2.6772z^{2} + 1.5774z \, + 0.4158}} $$

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.

  1. (i)

    The transformation function \( g\left( {\hat{z}} \right) \) should be a rational function of \( \hat{z} \).

  2. (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.

Table 5.6 Digital-to-digital transformations
  • Lowpass-to-lowpass transformation

Consider the transformation function

$$ z = \frac{{\hat{z} - b}}{{1 - b\,\hat{z}}} = g\left( {\hat{z}} \right) $$
(5.69)

where \( b \) is real. Then,

$$ {\text{e}}^{j\omega } = \frac{{{\text{e}}^{{j\hat{\omega }}} - b}}{{1 - b{\text{e}}^{{j\hat{\omega }}} }} $$

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

$$ {\text{e}}^{{j\omega_{\text{p}} }} = \frac{{{\text{e}}^{{j\hat{\omega }_{\text{p}} }} - b}}{{1 - b{\text{e}}^{{j\hat{\omega }_{\text{p}} }} }} $$

Hence,

$$ b = \frac{{{\text{e}}^{{ - j(\omega_{\text{p}} - \hat{\omega }_{\text{p}} )/2}} - {\text{e}}^{{j(\omega_{\text{p}} - \hat{\omega }_{\text{p}} )/2}} }}{{{\text{e}}^{{ - j(\omega_{\text{p}} + \hat{\omega }_{\text{p}} )/2}} - {\text{e}}^{{j(\omega_{\text{p}} + \hat{\omega }_{\text{p}} )/2}} }} = \frac{{{ \sin }(\omega_{\text{p}} - \hat{\omega }_{\text{p}} )/2}}{{\sin (\omega_{\text{p}} + \hat{\omega }_{\text{p}} )/2}} $$
(5.70)

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

$$ z = - \frac{{\hat{z} + b}}{{1 + b\,\hat{z}}} = g\left( {\hat{z}} \right) $$
(5.71)

where \( b \) is real. Then,

$$ {\text{e}}^{j\omega } = - \frac{{{\text{e}}^{{j\hat{\omega }}} + b}}{{1 + b{\text{e}}^{{j\hat{\omega }}} }} $$

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

$$ {\text{e}}^{{ - j\omega_{\text{p}} }} = - \frac{{{\text{e}}^{{j\hat{\omega }_{\text{p}} }} + b}}{{1 + b\,{\text{e}}^{{j\hat{\omega }_{\text{p}} }} }} $$

Hence,

$$ b = \frac{{{\text{e}}^{{ - j(\omega_{\text{p}} + \hat{\omega }_{\text{p}} )/2}} + {\text{e}}^{{j(\omega_{\text{p}} + \hat{\omega }_{\text{p}} )/2}} }}{{{\text{e}}^{{ - j(\omega_{\text{p}} - \hat{\omega }_{\text{p}} )/2}} + {\text{e}}^{{j(\omega_{\text{p}} - \hat{\omega }_{\text{p}} )/2}} }} = \frac{{\cos (\omega_{\text{p}} + \hat{\omega }_{\text{p}} )/2}}{{\cos (\omega_{\text{p}} - \hat{\omega }_{\text{p}} )/2}} $$
(5.72)

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:

  1. Step 1

    Find the normalized transfer function H N (z) of a lowpass filter using an approximation technique

  2. Step 2

    Obtain the passband edge \( \omega_{\text{p}} \) in H N (z)

  3. 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

$$ b = \frac{{\sin [(\omega_{\text{p}} - \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\omega }_{\text{p}} )/2]}}{{\sin [(\omega_{\text{p}} + \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\omega }_{\text{p}} )/2]}} = \frac{\sin [(0.2\pi - 0.3\pi )/2]}{\sin [(0.2\pi + 0.3\pi )/2]} = - 0.2212 $$

From the solution of Example 5.7, the digital transfer function with −3 dB cutoff frequency at \( 0.2\pi \) is

$$ H(z) = \frac{{0.068(z + 1)^{2} }}{{z^{2} - 1.142z + 0.413}} $$

Hence, the desired low pass transfer function with −3 dB cutoff frequency at \( 0.3\pi \) is given by

$$ \begin{aligned} & \left. {H(z) = \frac{{0.068(z + 1)^{2} }}{{z^{2} - 1.142z + 0.413}}} \right|_{{z = \frac{z + 0.2212}{1 + 0.2212z}}} \\ & \quad \quad = \frac{{0.1321(z + 1)^{2} }}{{z^{2} - 0.7467z + 0.2727}} \\ \end{aligned} $$

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

$$ b = \frac{{\cos [(\omega_{\text{p}} + \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\omega }_{\text{p}} )/2]}}{{\cos [(\omega_{\text{p}} - \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\frown}$}}{\omega }_{\text{p}} )/2]}} = \frac{ - \cos [(0.25\pi + 0.5\pi )/2]}{\cos [(0.25\pi - 0.5\pi )/2]} = - 0.4142 $$

From the solution of Example 5.11, the digital transfer function with passband edge frequency at \( 0.25\pi \) is

$$ H\left( z \right) = \frac{{0.2195z^{2} + 0.439z + 0.2195}}{{z^{2} - 0.31047z + 0.1887}} $$

Hence, the desired highpass transfer function with passband edge frequency at \( 0.5\pi \) is given by

$$ \begin{aligned} & \left. {H(z) = \frac{{0.2195z^{2} + 0.439z + 0.2195}}{{z^{2} - 0.31047z + 0.1887}}} \right|_{{z = \frac{0.4142 - z}{1 - 0.4142z}}} \\ & \quad \quad = \frac{{0.4857z^{2} - 0.9714z + 0.4857}}{{z^{2} - 0.6871z + 0.2564}} \\ \end{aligned} $$

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.

Fig. 5.16
figure 16

Lowpass filter magnitude responses

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.

Fig. 5.17
figure 17

Highpass filter magnitude responses

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.

Fig. 5.18
figure 18

Bandpass filter magnitude responses

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.

Fig. 5.19
figure 19

Bandstop filter magnitude responses

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.

Fig. 5.20
figure 20

Magnitude responses of the original and new lowpass filters

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.

Fig. 5.21
figure 21

Magnitude response of the highpass filter

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]:

  1. 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

  2. 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.

  3. Step 3

    When finished, access the startup window again. Select \( \to \) Edit \( \to \) Name. Change name (enter new variable name).

  4. Step 4

    Select File \( \to \) Export \( \to \) Export to workspace the new variable name

  5. 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.

Fig. 5.22
figure 22

Magnitude response of Butterworth lowpass filter

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.

Fig. 5.23
figure 23

Magnitude response of Chebyshev Type 1 lowpass filter

Fig. 5.24
figure 24

Magnitude response of elliptic lowpass filter

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.

Fig. 5.25
figure 25

Magnitude response of elliptic bandstop filter

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

$$ H(z) = \frac{{b_{0} \left( {z - {\text{e}}^{{j\omega_{0} }} } \right)\left( {z - {\text{e}}^{{ - j\omega_{0} }} } \right)}}{{\left( {z - r\,{\text{e}}^{{j\omega_{0} }} } \right)\left( {z - r\,{\text{e}}^{{ - j\omega_{0} }} } \right)}} $$
(5.73)

which can be rewritten as

$$ H\left( z \right) = \frac{{b_{0} \left\{ {z^{2} - \left( {2\,\cos \,\omega_{0} } \right)z + 1} \right\}}}{{z^{2} - \left( {2r\,\cos \,\omega_{0} } \right)z + r^{2} }} $$
(5.74)

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

$$ b_{0} = \frac{{\left| {1 - \left( {2\,\cos \,\omega_{0} } \right) + r^{2} } \right|}}{{\left| {2 - 2\,\cos \,\omega_{0} } \right|}} $$
(5.75)

If \( B_{{\text{W}}} \ll F_{{\text{T}}} \), the pole radius r can be approximated [12] as

$$ r = 1 - \left( {\pi B_{\text{w}} } \right)/F_{\text{T}} $$
(5.76)

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.

Fig. 5.26
figure 26

a Pole-zero plot and b magnitude response of notch filter of Example 5.31

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

$$ H\left( z \right) = \frac{{b_{0} \left( {z^{N} - 1} \right)}}{{z^{N} - r^{N} }} $$
(5.77)

And the transfer function for comb peaking filter is given by

$$ H\left( z \right) = \frac{{b_{0} \left( {z^{N} + 1} \right)}}{{z^{N} - r^{N} }} $$
(5.78)

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

$$ B_{\text{w}} = \frac{{2\pi f_{0} }}{Q} $$
(5.79)

The following MATLAB command can be used to design a comb notching filter or a comb peaking filter

$$ \left[ {\varvec{b},\varvec{a}} \right] = \varvec{iircomb}\left( {\varvec{N},\varvec{Bw},\varvec{Type}} \right) $$

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

$$ B_{\text{w}} = \left( {\frac{100\pi }{35}} \right) = 8.9760,\quad r = 1 - \frac{8.9760}{2200} = 0.9872 $$

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.

Fig. 5.27
figure 27

a Pole-zero plot and b magnitude response of comb notching filter of Example 5.32

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

$$ H(z) = \frac{{b_{0} z^{2} + b_{1} z^{{}} + b_{2} }}{{ \, a_{0} z^{2} + a_{1} z^{{}} + a_{2} \, }} $$
(5.80)

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.

Fig. 5.28
figure 28

Power spectrum of the speech signal corrupted with power supply hum

  • [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

$$ H(z) = \frac{{1.9716z^{2} - 3.9415z^{{}} + 1.9716}}{{ \, z^{2} - 1.9427 \, z^{{}} + 0.9438 \, }} $$
(5.81)

The magnitude response of the notch filter described by the above transfer function is shown in Fig. 5.29.

Fig. 5.29
figure 29

Magnitude response of IIR digital notch filter

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.

Fig. 5.30
figure 30

Power spectrum of the recovered 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.

Fig. 5.31
figure 31

Reverberated sound generation scheme

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.

Fig. 5.32
figure 32

Artificial reverberation generator

The structures for IIR filters and allpass reverberators are shown in Fig. 5.33a, b, respectively.

Fig. 5.33
figure 33

a Structure of IIR filter \( \left( {k = 1,2, \ldots ,K} \right) \) and b structure of allpass reverberator \( \left( {l = 1,2, \ldots ,L} \right) \)

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

$$ d_{1} = 8 0 0;\,d_{2} = 9 0 0 ;\,d_{3} = 6 5 0 ;\,d_{4} = 7 0 0 ;\,d_{5} = 6 7 0 ;\,d_{6} = 9 9 0 ; $$

and multiplier constants

$$ \begin{aligned} a_{1} & = 0.8;a_{2} = 0. 4 ; { }a_{3} = 0. 2 ; { }a_{4} = 0. 1 ; { }a_{5} = 0. 7 ; { }a_{6} = 0. 9 ; { }a_{7} = 0.6; \\ b_{1} & = 0.9;b_{2} = 0.8;b_{3} = 0.9;b_{4} = 1. \\ \end{aligned} $$

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.

Fig. 5.34
figure 34

a Original music sound and b reverberated

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.

Fig. 5.35
figure 35

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]

$$ H(z) = \frac{{b_{0} z^{2} + b_{1} z^{{}} + b_{2} }}{{ \, a_{0} z^{2} + a_{1} z^{{}} + a_{2} \, }} $$
(5.82)

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.

Fig. 5.36
figure 36

Magnitude and phase responses of the three second-order IIR peaking equalizers

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.

Fig. 5.37
figure 37

a Original sound and b sound obtained after passing through a peaking equalizer comprised of three cascaded IIR second-order filters

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.

Fig. 5.38
figure 38

Digital DTMF tone generator for the key ‘5’

  • 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]:

  1. 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.

  2. 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)
  3. Step 3

    Determine the Key by using two nonzero spectral components corresponding to the key is pressed.

  4. 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.

Table 5.7 DTMFs and their frequency bins

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.

Fig. 5.39
figure 39

DTMF tone detector using the Goertzel algorithm

  1. 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.

Fig. 5.40
figure 40

Spectral values and threshold for key 5

Program 5.12

DTMF Detection Using Goertzel Algorithm

5.8 Problems

  1. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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.