Analog Filtering 407

6.5 Analog Filtering 407

%%%%%%%%%%%%%%%%%%% % Example 6.11 -- Filter design using analogfil %%%%%%%%%%%%%%%%%%% clear all; clf alphamax = 0.1; alphamin = 60; Wp =10; Ws = 15; Wmax = 25; ind = 4 % elliptic design % ind = 3 % chebyshev2 design [b, a] = analogfil(Wp, Ws, alphamax, alphamin, Wmax, ind)

The elliptic design is illustrated above. To obtain the Chebyshev2 design get rid of the comment symbol % in front of the corresponding indicator and put it in front of the one for the elliptic design.

■ General comments on the design of low-pass filters using Butterworth, Chebyshev (1 and 2), and

Elliptic methods are:

The Butterworth and the Chebyshev2 designs are flat in the passband, while the others display ripples in that band.

For identical specifications, the obtained order of the Butterworth filter is much greater than the order of the other filters.

The phase of all of these filters is approximately linear in the passband, but not outside it. Because of the rational transfer functions for these filters, it is not possible to have linear phase over all frequencies. However, the phase response is less significant in the stopband where the magnitude response is very small.

The filter design functions provided by MATLAB can be used for analog or discrete filters. When designing an analog filter there is no constrain in the values of the frequency specifications and an ’s’ indicates that the filter being designed is analog.

General Filter Design

The filter design programs butter, cheby1, cheby2, and ellip allow the design of other filters besides low-pass filters. Conceptually, a prototype low-pass filter is designed and then transformed into the desired filter by means of the frequency transformations given before. The filter is specified by the order and cut-off frequencies. In the case of low-pass and high-pass filters the specified cut-off fre- quencies are scalar, while for band-pass and stopband filters the specified cut-off frequencies are given as a vector. Also recall that the frequency transformations double the order of the low-pass prototype for the band-pass and band-eliminating filters, so when designing these filters half of the desired order should be given.

■ Example 6.12

To illustrate the general design consider: (a) Using the cheby2 method, design a band-pass filter with the following specifications:

order N = 10

C H A P T E R 6: Application to Control and Communications

passband frequencies [10, 20] rad/sec

unit gain in the passband (b) Using the ellip method, design a band-stop filter with unit gain in the passbands and the following specifications:

order N = 20

α() = 0.1 dB in the passband

α() = 40 dB in the stopband

passband frequencies [10, 11] rad/sec The following script is used.

%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Example 6.12 --- general filter design %%%%%%%%%%%%%%%%%%%%%%%%%%%% clear all;clf N = 10; [b, a] = ellip(N/2, 0.1, 40, [10 11], ’stop’, ’s’) % elliptic band-stop %[b, a] = cheby2(N, 60, [10 20], ’s’) % cheby2 bandpass W = 0:0.01:30;

H = freqs(b, a, W); Notice that the order given to ellip is 5 and 10 to cheby2 since a quadratic transformation will be

used to obtain the notch and the band-pass filters from a prototype low-pass filter. The magnitude and phase responses of the two designed filters are shown in Figure 6.27.

(b) FIGURE 6.27 Design of (a) a notch filter using ellip and of (b) a band-pass filter using cheby2.

(a)

Problems 409