Anda di halaman 1dari 24

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

CNX Author | Legacy Site (//legacy.cnx.org/content/m28304/1.1?legacy=true) |

Find Content Search

or

Page 1 of 24

Donate (/donate)

Choose a Subject

FIR FILTER DESIGN: THE WINDOW DESIGN


METHOD
Page by: Nguyen Huu Phuong

Metadata +

FIR FILTER DESIGN: THE WINDOW


DESIGN METHOD
Page by: Nguyen Huu Phuong

Summary

The design of a FIR filter starts with its specifications in either discrete-time domain or DTFT
frequency domain, or both. In the time domain, the design objective is the impulse response. In the
frequency domain, the requirement is on various parameters of the magnitude response, shown in
Fig.5.8 for a lowpass filter. Important parameters are band edge frequencies p and s , passband

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

Page 2 of 24

Figure 1. Typical normalized magnitude response specfications of a lowpass filter

= s p , stopband , cutoff frequency c =(p + c )/2 ,


passband ripple (or deviation) p and stopband ripple s . The two ripples are usually assumed
[0, p ] , transition band

equal . Notice that for ideal (desired) filter, the passband frequency magnitude is normalized to 1 and
the stopband to 0 , and the frequency response of the designed filter oscillates between the high
amplitude of 1 or the low amplitude of 0.
Figure illustrates the specifications of bandpass filter. Here there are two sets of edge frequencies,
lower and upper. The rising bandwith l and the falling bandwidth u are usually assumed equal.
Even the initial requirement is imposed on magnitude response but we must design the filter having
linear phase or generalized linear phase.
Overall filter design
From the filter specifications, the first step is to choose between FIR and IIR filters based on their
advantages and disadvantages. This chapter only concerns FIR filters. The next step is to select the
proper linear phase FIR filters (section 5.2.3). A rather complete procedure for the design of FIR filters
are as follows.
Specifications of the filter
Choosing an appropriate linear phase filter type (section 5.2.3)
Choosing the mothod of design such as window, optimal, frequency sampling
Calculation the filter coefficients (impulse response)
Finding suitable structure
Analysis of the finite wordlength effects (chapter 7)
Implementation of the filter in hardware and/or software (chapter 7).Fig.5.9: Bandpass filter
specifications

Figure 2. Bandpass filter specifications

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

Page 3 of 24

Fixed windows
The impulse response of ideal filters is infinite duration (IIR). We cannot evaluate the corresponding
frequency response and, especially, implement the filter by hardware and/or software. Thus we must
truncate the impulse response at both ends with respect to the central. Even we truncate the impulse
response when it is small enough, but such a sudden cutoff will cause some undesired effects. The
window method will reduce them.
In the time domain, windowing means that the we multiply the desired (usually ideal) infinite
duration impulse response hd (n) by a finite duration window (or window function) w(n) to
get a soft truncation. The resulted impulse response h(n) of the designed filter is the product

h(n) = hd (n)w(n), 0 n M
Here we assume that all desired impulse responses and windows are causal, from n = 0 to
n = M , i.e. window length is M + 1 samples (time indices). Many authors start the design with

hd (n) and w(n) bi-sided (noncausal), i.e. defined in the interval then shift to the right M/2
indices to make them causal.
Multiplying in time domain corresponds to convolution in frequency domain. Thus the frequency
response of the designed filter (corresponding to the windowed impulse response h(n) ) is

1
H()= Hd ()W ()=
Hd (')W ( ')d'
2

where W () is the Fourier transform (DTFT) of the window w(n) .


In the window design method , we first evaluate the desired filter impulse response hd (n) from the
given desired frequency response Hd () , and then apply an appropriate window . Thus the method
should be called the Fourier window method.
Retangular window
Actually, the sudden truncation mentioned earlier is the simplest window called rectangular window,
defined as (Figure)

Figure 3. Rectangular window of order M or length M + 1

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

w(n)=
The Fourier transform of this window is

1 , 0nM
0 , otherwise

W () = w(n)e

jn

n=

Page 4 of 24

= ejn =
n=0

= ej

M
2

1 ej(M+1)
1 ej

sin (M+1)/2
sin /2

M +1 ,

0
=0

This is the same as Equation (3.54) when replacing M by 2N . Also, instead of the above
expression we can use the sum of cosines (Equations (3.46), (3.53)). W () has includes a phase
factor showing the time shift of a two-sided symmetric window to a causal window. The magnitude
and phase responses are, respectively,

Figure 4. Normalized frequency response of rectangular window for M = 30 and 50

sin (M+1)/2
|W ()| =
sin /2 ,

=0

M +1 ,
() =

M
+
2

where is 0 or as discussed in previous section. Thus the window is linear phase. Fig.3.27
illustrates the variation of the amplitude of W() (remember to replace 2N by M ). It is
maximum and equals to M + 1 at = 0 . The zero-crossing points are multiples of

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

. The response consists of a main lobe and many sidelobes. As

Page 5 of 24

gets larger the

main-lobe gets smaller, and there are more sidelobes, also narrower but the amplitude of the first
sidelobe remains the same (Fig.5.11). As M , W() tends to be an unit sample () .
2/(M
+ 1)
M

Figure 5. Magnitude response of designed lowpass filter when using rectangular window with M = 44

The oscillatory W() when convolved with the ideal lowpass response Hd () will result in a
response H() having a non-zero transition width and ripples is both the passband and stopband.
Fig.5.12 shows the designed lowpass filter when using rectangular window having M = 44 to
abruptly truncate the impulse response of an ideal lowpass filter with cutoff frequency c =
Fig.5.13 shows the magnitude in linear scale for two case of filter order, M = 10 and M = 18.

/2 .

In order that H() approaches Hd () the rectangular window must be of infinite duration, i.e. we
must take into account the whole impulse response without truncation. In frequency domain this
means W () is an unit sample () as said. We can reason in the reverse direction: Since

H()= Hd ()()= Hd () then () must be a unit sample and the windows must be of
infinite duration. When we simulate H() on a computer using Maltlab sofware, or else, with M in
the hundreds we will still see the non-zero transition width and ripples due to the Gibbs phenomenon
(section 3.1.4). An infinitely long windows is not practical, so the idea is to look for finite duration
windows which perform better than the rectangular.

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

Page 6 of 24

Actually in examples 5.2.1 and 5.2.2 the truncation of the impulse responses of the ideal filters meant
the rectangular window had been applied.

Figure 6. Magnitude response of designed filter for M = 10 and M = 18

Other windows
The Gibbs phenomenon can be reduced considerably by the use of a softer (less abrupt) truncation,
i.e. by tapering the rectangular smootly to zero at both ends. Unfortunately, the reduction in amplitude
of sidelobes of H() is accompanied by a widening of its mainlobe. For comparision, the window
responses W() are usually plotted in dB scale.

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

Page 7 of 24

Figure 7. Triangular window (Bartlett window)

Several smooth window functions have been proposed and used. It might come to our mind that the
first applicant would be the triangular window, also called Bartlett window , depicted in Fig.5.14.
From the figure we can write the window function ( table 5.1). Table 5.1 lists common fixed windows
and Fig.5.15 plots their functions. Fig.5.16 plots the dB magnitude for and Fig.5.17 for M = 50.The first
sidelobe is at -25dB compared to the -13dB of the corresponding (same length) rectangular window.
However the mainlobe width is about twice as large.

Figure 8. Common window plotted as function of continuous time n (whereas actual windows are function
of discrete index n)

The sidelobe of the triangular window is still high because the tapering is still rather coarse. For
smoother tapering, cosinusoid is incorporated into the window function. This observation has led to
the three well known windows: Hanning (or von Hann), Hamming, and Blackman, all defined in the
interval 0 n M , otherwise zero (table 5.1). We can check that the functions are normalized
(peak value of 1 at n = M/2 ) and zero at both ends except the rectangular and the Hamming
(0.08 instead of 0). Besides, there are many other less-used fixed windows.
Notice that all windows mentioned, from rectangular to Blackman, are simple functions easily
evaluated, and their frequency responses concentrate around = 0 (the mainlobe) as expected.
Also notice that all the windows mentioned are symmetric about the mid-point n = M/2 , this
when combined with the symmetry or antisymmetry of the filters impulse response will make the
corresponding designed filter linear phase or generalized linear phase.

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

Page 8 of 24

Figure 9. dB magnitude frequency response of fixed windows for M = 20 (a) Bartlett, (b) Hanning, (c)
Hamming, (d) Blackman

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

Page 9 of 24

Figure 10. dB magnitude frequency response of various windows for M = 50 (a) Bartlett, (b) Hanning, (c)
Hamming, (d) Blackman

Table 5.2 lists various features of common windows for comparison. The passband ripple and the
stopband ripple s and the stopband ripple s , are taken equal (the smaller of the two):

A = 20log10 [min(p , s )]
Fig.5.16, Fig.5.17 and Table 5.2 show that no window is the best in all aspects but there is a tradeoff
of features, and the choice of an appropriate window depending on our requirement. For smallest
mainlobe width its the rectangular window, for best sidelobe attenuation its the Blackman. In
between, the Hamming is a good choice. The Bartlett is the transition from the rectangular to the other
windows. See section 5.3.3 for design examples.

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

Page 10 of 24

The Kaiser window


The windows discussed so far are fixed windows, only the length (M

+ 1) is adjustable. The

Kaiser window has an additional ripple parameter , enabling the designer to tradeoff the transition
and ripple. It is defined in the interval 0 n M , otherwise zero:

w(n) =

nM/2

I0 {
1 ( M/2 ) 2 }
I0 ()

0nM

where I0 (x) is the modified zeroth-order Bessel function, computed by a power series
expansion:
2

x(2)
x2
1 x2 x2
1 x2 x4
] =1+
I0 (x)= 1 + [
+ 2

+ 2

+
k!
4
4
4
z
4
16
2
k=1
k

Following is the values of I0 (x) for small x :

I0 (n)

0.0
0.1
0.2
0.4
0.6
0.8
1.0

1.000
1.002
1.010
1.040
1.092
1.166
1.266

1.2
2.0
3.0
4.0
5.0
6.0
7.0

I0 (n)
1.3938
2.2796
4.3306
11.302
27.240
67.235
168.59

The upper limit of the summation does not need to be too large, say about 20 at the most.

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

Page 11 of 24

Figure 11. (a) Kaiser window for = 0, 3 and 6 and M = 20, (b) Magnitude response corresponding to
the windows in (a), (c) magnitude response for = 6 and M = 10, 20,

= 0 both the numerator and denominator are 1 and the Kaiser window becomes the
rectangular window, and for = 5.44 it is near to the Hamming window. The parameter is so
For

chosen that the magnitude response of the filter lies in the allowed region (see Fig.5.1). Fig.5.18
shows the Kaiser for various values of and M . Notice that the Kaiser is also symmetric. It has
minimum stopband attenuation from 50dB (for = 4.54 ) to 90dB (for = 8.96 ), so we can
choose a Kaiser window to have maximum stopband atternuation equal to the Blackman window (74,
Table 5.2) or higher.

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

Page 12 of 24

For ideal filters (Fig.5.1 and Fig.5.2) the Kaiser window has equal ripple in both the passband and
stopband. For real filters the ripples are slightly different . In design we take the common ripple as

= min(p ,s ) of the desired values p ,s . As said earlier, actually is usually specified in term
of dBs: A = 20log10 , for example = 0.01 then A = 40dB , = 0.001 then
A = 60dB . Since is a fraction of 1 then A is always ponsitive.
Kaiser has developed empirical formulae and guide for the application of the window. Following is
design steps for lowpass filters (similarly for other frequency selective filters).
1/ Specifications of edge frequencies p ,s ; ripples p ,s
2/Evaluate the minimum ripple A = 20log10 [min(p ,s )] , the cutoff frequency
c = (p + s )/2 , the transition width = s p
3/ Determine the filter filter order M

M=

M=

A7.95
2.285

5.79

A > 21

A 21

4/ Determine the parameter , depending on A:

= 0,

A 21
0.4

= 0.5842(A 21) + 0.07886(A 21),


= 0.1102(A 8.7),

21 A 50
A 50

5/ Computer the window coefficients w(n) from the formula (5.40)


6/ Compute the impulse response hd (n) of the desired filter which is linear phase
7/ Compute the designed impulse response h(n)=

hd (n)w(n) .

8/ Find the frequency response H() = IDT FT [h(n)] to check with specifications. For bandpass
filter the two transition bandwidths are usually equal, if not we take the smaller one.

Design examples
Example
Design a linear phase lowpass filter using the Hamming window to meet the specifications
Cutoff frequency 2.5 kHz
Transition width 1.65 kHz
Stopband attenuation >50dB
Sampling frequency 10kHz

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

Page 13 of 24

Solution
The relation between the analog linear frequency F samples/sec (or Hz) and the digital angular
frequency radians/sample is (Equation 1.40) is

= 2

F
fs

where fs is the sampling frequency (samples/sec, or Hz). Thus


2.5
= 0.5 rad/sample
Cutoff frequency c = 2
10
1.65
Transition width = 2 10 = 0.33 rad/sample
Table 5.2 shows that the Hamming satisfy (so can the Blackman) the maximum stopband attenuation
( 20log10 s ) requirement. Table 5.2 includes the relation between transition width and
window order M :

6.6
6.6
= 20
M=
M
0.33

Now we compute the causal impulse response hLP (n) of ideal lowpass filter (Equation (5.32)) for

0 n 20 . Notice that for M even and h(n) symmetric we have linear phase FIR-1
(Fig.5.4a). The result is plotted in Fig.5.19a.
Next we evaluate the Hamming window

w(n) = 0.54 0.46 cos

2n
,
M

0 n M = 20

The result is plotted in Fig.5.19b.


The impulse response of the designed filter is the product

h(n) = hLP (n)w(n) ,

0 n M = 20

We can evaluale w(n) and hLP (n) separately as above then take the product, or evaluate the
product directly . The result is plotted in Fig.5.19c. We then take the inverse transform of h(n) to get
the frequency response H() :

H()= n= h(n)ejn = n=0 h(n)ejn ,

M = 20

Fig.5.19d shows |H()| , and Fig.5.19c shows |H()|dB .


Example

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

Page 14 of 24

We need ro extract a low frequency signal having bandwidth 200Hz and center frequency 300Hz
from a blackground noise. Design a bandpass filter having transition width 100Hz, passband
ripple 40dB, stopband ripple 60dB. The sampling frequency is 1200Hz.
Solution
The passband of the signal is from 300 200/2 to 300 + 200/2, i.e. from 200Hz to 400Hz. We are to
design a bandpass FIR filter to meet the specifications
Passband: 200Hz
Transition width: 100Hz

Figure 12. Example(linear phase lowpass filter with c = 0.5, = 0.33 ) using the Hamming
window

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

Page 15 of 24

Figure 13. Example(linear phase bandpass filter using Blackman window

Passband ripple:

(20log10 p )= 40dB (p = 0.01)

Stopband ripple: (20log10 p ) = 60dB s = 0.001


Sampling frequency: 1200Hz
From Table 5.2 see that only the Blackman window can satisfy the stopband ripple (so can the Kaiser
window, see next subsection). Since the passband and stopband attenuations are different, we take
the smaller one in the design, i.e. A = 60dB. The transition width and the filter order are, respectively,

= 2

100

=
1200
6

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

Thus the Blackman window is

M=

W (n) = 0.42 0.5 cos

Page 16 of 24

11.1
= 66.6 67
/6

2n
4n
+ 0.08 cos
,
M
M

0 n M = 67

Ideal bandpass filter impulse response (Equation 5.10b)

hBP (n) =

sin u n
sin l n

n
n

where

u = 2

400
2
=
1200
3

l = 2

200

=
1200
3

Since M is odd we have linear phase type 2 (FIR-2) . The designed impulse response is

h(n)= hBP (n)w(n)


We then take the inverse transform of h(n) to get or the frequency response of the designed filter
(Fig.5.20).

Example
Design a highpass FIR filter using Kaiser window to meet the specifications :
Cutoff frequency 2,5 kHz
Transition width 0.5 kHz
Passband ripple 0.001
Stopband attenuation 40dB
Sampling frequency 10kHz
Solution
First lets derive the expression of the impule response of ideal highpass filter (Fig.5.1b) with
generalized linear phase (Fig.5.4) (Fig.5.1b) with generalized linear phase (Fig.5.4). The frequency
response of the causal highpass filter in the interval = [0, ] is

HHP () = 0,
ej

M
2

0 c
,

c <

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

or related to the frequency response of the lowpass filter

HHP ()= ej

M
2

Page 17 of 24

(Equation (5.32)) as

HLP ()
HLP ()

Taking the inverse DTFT of either above expression we will get the impulse response of the ideal
highpass filter
)

hHP ( n =

sin (nM/2)
(nM/2)
1 c ,

sin c (nM/2)
(nM/2)

n0
n=0

Notice that we cannot just shift the result of the two-sided symmetric impulse response Equation
(5.10a) to get the above causal result (but must replace (n) by sinn/n before shifting).
The given specifications are interpreted as
2.5
Cutoff frequency : c = 2
= 0.5 rad/sample
10
0.5
Transition width : = 2
= 0.1 rad/sample
10
Passband ripple : p = 0.001
Stopband ripple : 20log10

= 40 dB s = 0.01

Thus the attenuation is

A = 20log10 [min(p , s )] = 20log10 p = 60 dB


Knowing and A we can determine the window order

M=
Since A

A 7.95
60 7.95
=
= 72.5 72
2.285
2.285(0.1)

> 50 dB, the ripple parameter is given by


= 0.1102(A 8.7)= 5.65

With M/2 = 33 and = 5.65 , the Kaiser window (Equation (5.40)) is

W(n) =

2
1 ( n36
I0 {5.65
)
}
36
I0 (5.65)

The impulse response of the FIR-1 highpass filter hHP (n) is computed for 0 n 66 , and the
designed impulse response is

h(n)= hHP (n)w(n)


As usual, the frequency response is the inverse DTFT of above impulse response.. Using Matlab we

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

Page 18 of 24

can simulate all the responses.

Error in the Fourier design method


Lets briefly consider the error in the Fourier design. Just like the Fourier series expansion of a signal
(section 3.1), the Fourier design method give the least mean square (LMS) error as presented here.
This also applies to the case of abupt truncation of the desired impulse , that is using the rectangular
window. Let () be the error between the desired ideal frequency response Hd () and the
designed frequency response H() :

() = Hd () H()
This error varies with frequency and is a complex quantity , the same as the frequency response. We
are interested in the error amplitude, so we take the square
2
2
2

()
= Re () + Im () = () ()
2

Since |()| still depends on frequency, we then take its average value:

1
2

|()| d =

1
2
1
2

() ()d

[Hd () H()][Hd () H()]2 d

The problem is to find H() so that the mean square error H() is smallest (i.e. least mean square LMS). Because the frequency response H() can be expressed in term of the designed filter impulse
response h(n) , we thus look for the filter impulse response for LMS error. To this end we take the
derivative d/dh(n) and equate it to zero to find the root of h(n) for the minimum

. After some mathematics (not presented here) , we will get the impulse response

h(n) =

1
Hd ()ejn d = hd (n)
2

This result means that when we start the design by evaluating the impulse response from the given
(desired) filter frequency response then we will get the LMS error (i.e. no other design method can
give a smaller mean square error) .
In LMS error we emphasized the large errors ( at local frequencies). This criterion is not always
adopted , other criterion may be more privileged, such as the transition width must be as narrow as
possible, or the error must be distributed evenly in both the passband and the stopband

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

Page 19 of 24

Digital differentiator
In digital signal processing , sometimes we need to take the differentiation or integration of a signal .
For example the differentiation (derivation) of displacement is speed, and the differentiation of speed
is acceleration. It is interesting that the former can just be realized by a FIR filter or by an IIR filter,
whereas the latter by an IIR filter. In this section we will discuss digital differentiators (Fig.5.2)
designed by linear phase FIR-3 and FIR-4 associated with windowing. Other FIR design method ,
such as the optimal method discussed in the subsequent section , can also be used.
In an analog differentiator the output signal y(t) is related to the input signal x(t) by

y(t) =

dx(t)
dt

For a LTI (LSI) digital system having frequency response (i.e.DTFT) H() , an input x(n) = ejn
will give the output H()ejn (section 3.7.3):

y(n) = H()ejn
On the other hand the derivative of the input x(n) = ejn is

y(n) =

dx(n)
= jejn
dn

By comparing the above two expressions we obtain

H () = j ,

This is the frequency response of ideal digital differentiator. The response is purely imaginary, the
magnitude response |H()| is proportional to the frequency and the phase response () is /2 ,
independent of frequency (Fig.5.2) . Thus differentiators are generalized linear phase (Equation (5.17)
with = 0 , = /2 ). Fig.5.21 shows the variation of |H()| .

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

Page 20 of 24

Figure 14. Frequency response of various types digital differentiators

Even looked so simple but the such a differentiator cannot be realized exactly in practice . Thus
approximate ciruits are used, the simplest of which is the first order differentiator which is just the
difference

y(n) = x(n) x(n 1)


Its frequency response can be found to be

H() = 1 ej = (1 cos ) + j sin


whose magnitude is
1/2

H()= [(1 cos )2 + sin2 ] = 2 sin

This is plotted in Fig.5.21 . The approximation is surprisingly good especially at low frequency. Notice
that for small ,

H() (1 1) + j = j

(small )

Actually a differentiator is usually designed to use at the low frequency because the high response at
high frequency will enhance noise. This again means that the simple first order differentiator is very
good. The linear phase FIR filter implementing the differentiator is of FIR-4 type ( H() = 0
at = 0 and 0 at = )
In order to reduce the high response at high frequency, the central differentiator is the candidate :

y(n) = 0.5x(n) 0.5x(n 2)

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

Page 21 of 24

having frequency response

H() = 0.5 0.5ej2 = 0.5 [(1 cos 2) + j sin 2]


The magnitude response is

|H()| = sin
The response is also plotted in the same Fig.5.21. Notice also that H() 0 at low . The linear
phase FIR filter implementing the differentiator is of FIR-3 type ( H() = 0 at both = 0 and
= ).

Example
For the ideal differentiator.
2. Find the expression of its two-sided impulse response . Evaluate and plot the response for
M/2 n M/2 with M = 20
4. Find the expression of its causal impulse response.
6. Design a differentiator using the Hamming window of length 21.
Solution
Taking the inverse DTFT of the known frequency response H() = j we will get the twosided impulse response.

hDIF (n) =
=

1
2

1
2

Hd ()ejn d

H() cos nd + j

1
Hd ()sinn d
2

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

Page 22 of 24

Figure 15. Example impulse response having M = 20 of ideal differentiator ((a) two-sided (noncausal), (b)
causal)

Because Hd () is an odd function while cosine is even and sine is odd, we only need to take the last
term of the above expression:
1
hDIF (n) = j 2

Hd () sin nd = 1

sin nd

cos n
n

n0
0

n=0

or

hDIF (n) = n1 ,
1
n

0,

n = 1, 3, 5...

n = 2, 4, 6...
n=0

The last case is obtained by taking the original integral. Fig 5.22a depicts the impulse response which
is of FIR-3.
2. We cannot just shift the noncausal result Equation (5.49a) M/2 time indices , i.e. by replacing n by n
M/2 , together the causal impulse response. Lets start from the frequency response of a causal
linear phase differentiator ( the two-sided response j is delayed by M/2 samples):

H() = jej

M
2

Taking the inverse transform to get the causal impulse response

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

hD/F (n) =

cos(nM/2)
(nM/2)

sin(nM/2)
(nM/2) 2

Page 23 of 24

n M/2

When putting M/2 = 0 in above Equation


expected.
0 , we will get back Equation (5.49a)
n =asM/2
In both impusle response (5.49a) and (5.50) we can notice that hD/F (n) = hD/F (M n) , thus
the differentiator is linear phase type 3 when M is even (Fig.5.4c) or type 4 when M is odd (Fig.5.4d).
3. Window length of 21 means M + 1 = 21 and the filter order is M = 20. We can use the two-sided
impulse response in (a) and shift M/2 = 10 time indices to the future to get the causal response , or
use the causal response in (b) . Fig.5.23a is the frequency response of the differentiator with
truncation (equivalent to using rectangular window), Fig.5.23b is the frequency response of the
differentiator when using the Hamming window. The optional method (later section) is a better method
to design digital differentiator.

Figure 16. Example (magnitude response of differentiator for M = 20 when (a) using truncation
(rectangular window) and (b) using the Hamming window)

Downloads +

History +

Attribution +

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

FIR FILTER DESIGN: THE WINDOW DESIGN METHOD - OpenStax CNX

Licensing (/license)

Terms of Use (/tos)

Page 24 of 24

Contact (/about/contact)

Supported by William & Flora Hewlett Foundation, Bill & Melinda Gates Foundation, 20 Million Minds
Foundation, Maxfield Foundation, Open Society Foundations, and Rice University. Powered by OpenStax
CNX.
(http://creativecommons.org)

1999-2015, Rice University. Except where otherwise


noted, content created on this site is licensed under a

Creative Commons Attribution 4.0 License.

http://cnx.org/contents/d98107c1-0621-49bc-9f3b-1a72b19314c8@1/FIR-FILTER-DESIG... 12/3/2015

Anda mungkin juga menyukai