PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

Analog and Digital Filters 595


Any window model can be used as long as its length is L + 1.
The MATLAB default window is the Hamming window.
R.6.138 The Parks–McClellan algorithm is a popular alternative to the windowing syn-
thesis algorithms followed for the FIR fi lter case. The process is based on the
Chebyshev polynomials and its implementation resulting in a highly effi cient
iterative procedure called the remez exchange algorithm developed during the 1970s.
MATLAB implements the remez algorithm by calling one of the remez family of
functions indicated as follows:

hn = remez (L, f, mag)
hn = remez (L, f, mag, wei)
hn = remez (L, f, mag, ‘fi ltertype’)
hn = remez (L, f, mag, wet, ‘fi ltertype’)

R.6.139 The Parks–McClellan algorithm is frequently used in the design of FIR multiband
linear-phase fi lters. The output is the impulse response coeffi cients of length
N = L + 1 in descending powers of z.
The vector f specifi es the frequencies, over the range 0 ≤ f ≤ 1, with a sampling
frequency of 2 Hz, where f must be specifi ed as an increasing sequence (over the
range of frequencies), whereas the corresponding magnitudes are given by mag,
and where the frequency spacing of f must be at least 0.1.
Recall that the vector mag corresponds to the magnitudes at the frequencies
specifi ed by the vector f (also defi ned over the range 0 ≤ mag ≤ 1) and can be fur-
ther controlled by an additional weighted vector wei.
R.6.140 Observe that the remez functions use no window since recursive optimization
techniques are used in the algorithm and the windowing technique would undo
the optimization process.
R.6.141 For example, a normalized multilevel fi lter spec is shown by the sketch in Fig-
ure 6.19. This fi lter spec is implemented below by the remez function defi ned by
the row vectors f and mag given by

f = [0 .3 .5 .7 .9 1]
mag = [.4 .7 .5 0 .8 .8]

Observe that the range 0 ≤ f ≤ 0.3 is specifi ed by the elements f(1) and f(2) result-
ing in a magnitude of 0.4 specifi ed by the fi rst element of mag.
When a band of frequencies is irrelevant, the magnitude in that band constitutes
a don’t care condition. The simplest and effi cient way to implement a don’t care is by
repeating the previous magnitude entry in the vector mag.
For example, let us assume that the range 0.5 < f < 0.7 constitutes a don’t care in
the frequency sketch of Figure 6.19. Then this condition can be implemented by
substituting the value of mag(2) (0.7 instead of 0.5) for the entry mag(3).
R.6.142 Some practical observations and a summary for the two discrete types of fi lters
IIR and FIR are given as follows:
a. FIR fi lters have no feedback loops and therefore are always stable, easy to design,
usually requiring a large number of components; in the order of 5–10 times more
Free download pdf