Thursday 28 June 2018

DIGITAL FIR FILTERS-IV DESIGN OF LOW-PASS FILTERS USING WINDOW FUNCTIONS


EDITOR: B. SOMANATHAN NAIR

1. INTRODUCTION
The accuracy of an FIR filter can be increased by increasing the number of filter coefficients. It may be noted that this is a trial-and-error procedure. We find that there will be infinite number of values of filter coefficients as n ® ± ¥. We can also see that the larger the n, the smaller the value of the filter coefficients. Because of this, there is no meaning in finding the coefficients beyond a certain value of n. The actual number of coefficients to be computed depends on the accuracy that we need in the realization of the filter as well as on the number of bits that the computer used to solve the problem can handle.

2. DESIGN OF FIR FILTERS USING WINDOW FUNCTIONS
As stated above, finite register length of computers necessitates abrupt termination of FIR filter coefficients at some finite value of n. In turn, this gives rise to the Gibb’s phenomenon, which is dangerous in many situations, as it gives rise to sharp transients. In many situations, these transients may destroy the hardware used for the construction of the filter. So, it must be avoided at all costs. To prevent the occurrence of the Gibb’s phenomenon, we must avoid abrupt truncation of filter coefficients. To avoid abrupt truncation, we use a function having a tapering characteristic, as shown in Fig. 1. Such functions having tapering characteristics are known as window functions. Half-cosine wave is an example of a window function. When the impulse response h(n), derived from the given transfer function H(w), is multiplied by an appropriate window function w(n), we get a modified impulse function h¢(n), which shows a set of gradually decreasing filter coefficients. These filter coefficients in turn will ensure the absence of the Gibb’s phenomenon from the operating regions of the filter).




            Thus, to prevent the occurrence of the Gibb’s phenomenon, we must use a modified impulse response given by

                                                  h¢(n) = h(n)´w(n)   (1)                                                   

2. COMMONLY USED WINDOW FUNCTIONS
Two typical examples of window functions are:

(a)               The Rectangular window
(b)              The Hann (Hanning) window

(a) THE RECTANGULAR WINDOW
Let us consider the rectangular window defined by the equation

                       wR(n)    = 1, ‒­M n M        
                                                      = 0, elsewhere   (2)                                                               

            The response characteristic of this window can be seen to be the same as that of the ideal characteristic shown in Fig. 1. Now, substitution of (2) into (1) yields the modified impulse response

       h¢(n) = h(n)´wR(n) = h(n), ‒­M n M                                            
                                                            = 0,   elsewhere        (3)                  

            Equation (3) says that the modified impulse response h¢(n) is the same as the original  impulse response h(n). This means that this window will result in abrupt cut-off of filter coefficients, which will lead to the generation of the Gibb’s phenomenon. Hence this window is never used for practical design of FIR filters.

(b) THE HANN (OR HANNING) WINDOW
The Hann or Hanning window (named after J. Von Hann) is defined as
                                   
wH(n) = 0.5 + 0.5 cos(2πn/N), ‒­N/2 n N/2   (4)                          

where N = order of the filter. Putting M = N/2, we rewrite (4) as

                                    wH(n) = 0.5 + 0.5 cos(πn/M), ‒­M n M   (5)
                                                   
Changing the limits, (4) may also be written as

           
wH(n) = 0.5 ‒ 0.5 cos(πn/M), 0 n N   (6)

Inspection of (4) and (6) reveals that, even though they represent the same function, there exists a difference in the signs of the second terms on the right-hand side of the two expressions. As can be seen, this difference in the equations is created by the difference in the limits used. However, both these equations yield the same final results. Even though designs using (5) result in noncausal filters, because of its convenience and easiness in application, in this blog, we shall be using this equation with limits from –M to M.
Let us now use (5), and calculate wH(n) for a tenth-order (i.e., N = 10) window, noting that wH (n) = wH (-n). Thus

wH(0) = 0.5 + 0.5 cos(0) = 1   (7)    
                      wH(1) = wH(‒1) = 0.5 + 0.5 cos(π/5) = 0.9045 = (8)
wH(2) = wH(‒2) = 0.5 + 0.5 cos(2π/5) = 0.6545 (9)
wH(3) = wH(‒3) = 0.5 + 0.5 cos(3π/5) = 0.3455 (10)
                      wH(4) = wH(‒4) = 0.5 + 0.5 cos(4π/5) = 0.0955 (11)
wH(5) = wH(‒5) = 0.5 + 0.5 cos(5π/5) = 0.0 (12)
           
            The results given in (7) to (12) are used for plotting the waveform shown in Fig. 2. This waveform is known as the raised-cosine waveform, as it looks like the positive half-cycle of a cosine wave raised from its negative portion to zero to make it into a variable DC wave.



Example 2: Use the Hann window to the solution given in Example 1 in the previous blog to determine the modified impulse response.

Solution:  We have, from Example 1 in the previous blog, the impulse response

                   h(n) = 0.5 sin(nπ/2)/(nπ/2)   (13)                                                                    
                                                                                   
We now perform h(n) x wH(n) to get the modified impulse response. Thus we obtain

                                                h’(0) = 0.5 x 1 = 0.5
                                                h’(1) = h’(‒1) = 0.3183x0.9045 = 0.2879
                        h’(2) = h’(‒2)  = 0                       
                        h’(3) = h’(‒3)  = ‒1061x 0.3455 =‒0.0367                                                 h’(4) = h’(‒4) = 0
                        h’(5) = h’(‒5) = 0      
                                               
The filter-transfer function can be obtained by using the above values of the modified impulse response. The causal filter so obtained has its transfer function given by

            H(z) = ‒0.0367­z‒2 +0.2879 z‒4 + 0.5 z‒5 +0.2879 z‒6 ‒0.0367 z‒8
                       


No comments:

Post a Comment

DISCRETE SIGNAL OPERATIONS

EDITOR: B. SOMANATHAN NAIR 1. INTRODUCTION In the previous two blogs, we had discussed operations of scaling and shifting on conti...