PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

594 Practical MATLAB® Applications for Engineers


R.6.133 The window effect in the time domain is translated in limiting the number of
terms of the impulse response of a fi lter.


R.6.134 The infi nite sequence response hIIR(n) can be truncated in the time domain by lim-
iting the sequence by an appropriate window function labeled win(n).
This fact translates into a fi nite response sequence hFIR(n).
Therefore, analytically


hFIR(n) = hIIR(n) * win(n)


R.6.135 Recall that the product of two sequences in the time domain such as hIIR(n) times
win(n) translates in a convolution of their respective transform of each of the
sequences in the frequency domain (Chapter 5).


R.6.136 The following family of MATLAB functions:


hn = fi r1 (L, Wn)


hn = fi r1^ (L, Wn, ‘fi ltertype’)^


(^) hn = fi r1 (L, Wn, window)
hn = fi r1 (L, Wn, ‘fi ltertype’, window)
are multipurpose functions used in the design of LP, HP, BP, and BS FIR fi lters
employing the Fourier series approach.
The fi r1 command returns the impulse response coeffi cients hn with length
N = L + 1.
LPF are designed with a normalized cutoff frequency over the range 0 ≤ Wn ≤ 1.
The function hn = fi r1 (L, Wn), for example, can be used to design a BPF by
defi ning Wn as a row vector consisting of two elements, Wn = [Wl Wu], where Wl
represents the low-frequency edge, whereas Wu is its high-frequency edge.
The MATLAB function hn = fi r1 (L, Wn, ‘high’) returns the HPF impulse response
of length L (where L is an even integer).
The same function can be used to design an SBF by replacing ‘high’ by ‘stop’,
where Wn is a two-element row vector.
If no window is specifi ed, the Hamming window is the default option. If the fi lter-
type is not specifi ed an LPF is the default option.
R.6.137 The MATLAB functions:
hn = fi r2(L, f, mag)
hn = fi r2(L, f, mag, window)
are used in the design of the magnitude response of arbitrary-shaped LPF, where
L is the fi lter order with the magnitude specifi ed by the vector mag at the frequen-
cies given by the vector f.
The output of the vector hn is of length N = L + 1 and the coeffi cients are
arranged in descending order of z. Obviously, the length (f ) must agree with the
length (mag) and f must have as its fi rst element a 0 and a 1 as the last.
A jump condition at fx is indicated by two samples, both with the same fre-
quency fx but with different magnitudes.

Free download pdf