1 Introduction to Digital Filters Filter: A filter is essentially a system or network that...

41
1 Introduction to Digital Filters Filter: Filter: A filter is essentially a A filter is essentially a system or network that selectively system or network that selectively changes the wave shape, changes the wave shape, amplitude/frequency and/or amplitude/frequency and/or phase/frequency characteristics of a phase/frequency characteristics of a system in a desired manner. system in a desired manner. Common filtering objectives: Common filtering objectives: to improve the quality of a signal to improve the quality of a signal to extract information from a to extract information from a signal signal to separate two or more signals to separate two or more signals previously combined. previously combined.

Transcript of 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that...

Page 1: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

1

Introduction to Digital Filters Filter: Filter: A filter is essentially a system or A filter is essentially a system or

network that selectively changes the wave network that selectively changes the wave shape, amplitude/frequency and/or shape, amplitude/frequency and/or phase/frequency characteristics of a system in a phase/frequency characteristics of a system in a desired manner.desired manner.

Common filtering objectives: Common filtering objectives: to improve the quality of a signalto improve the quality of a signal to extract information from a signalto extract information from a signal to separate two or more signals previously to separate two or more signals previously

combined.combined.

Page 2: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

2

Digital Filter:A digital filter is a mathematical algorithm A digital filter is a mathematical algorithm

implemented in hardware and/or software that implemented in hardware and/or software that operates on a digital input signal to produce a operates on a digital input signal to produce a digital output signal for the purpose of digital output signal for the purpose of achieving a filtering objective.achieving a filtering objective.

A simplified block diagram of a real time A simplified block diagram of a real time digital filter is shown below:digital filter is shown below:

x(t)x(t) Inputfilter

ADC withsample &

hold

Digitalprocessor

DACoutputfilter

Page 3: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

3

Advantages of Digital Filters:

Digital filters can have characteristics which are not Digital filters can have characteristics which are not possible with analogue filters, such as a truly linear possible with analogue filters, such as a truly linear response.response.

Unlike analog filters, the performance of digital filters Unlike analog filters, the performance of digital filters does not vary with environmental changes. This eliminates does not vary with environmental changes. This eliminates the need to calibrate periodically.the need to calibrate periodically.

The frequency response of a digital filter can be The frequency response of a digital filter can be automatically adjusted if it is implemented using a automatically adjusted if it is implemented using a programmable processor, which is why they are widely programmable processor, which is why they are widely used in adaptive filters.used in adaptive filters.

Several input signals or channels can be filtered by one Several input signals or channels can be filtered by one digital filter without the need to replicate the hardware.digital filter without the need to replicate the hardware.

Both filtered and unfiltered data can be saved for further Both filtered and unfiltered data can be saved for further use.use.

Page 4: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

4

Advantages of Digital Filters:

Advantages can be readily taken of the tremendous Advantages can be readily taken of the tremendous advancements in VLSI technology to fabricate digital advancements in VLSI technology to fabricate digital filters and to make them small in size, to consume low filters and to make them small in size, to consume low power, and to keep the cost down.power, and to keep the cost down.

In practice the precision achievable with analog filters is In practice the precision achievable with analog filters is restricted. With digital filters precision is limited only by restricted. With digital filters precision is limited only by the wordlength used.the wordlength used.

The performance of digital filters is repeatable from unit to The performance of digital filters is repeatable from unit to unit.unit.

Digital filters can be used at very low frequencies. Also, Digital filters can be used at very low frequencies. Also, digital filters can be made to work over a wide range of digital filters can be made to work over a wide range of frequencies by a mere change to the sampling frequency.frequencies by a mere change to the sampling frequency.

Page 5: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

5

Disadvantages of Digital Filters Speed Limitation:Speed Limitation: The maximum bandwidth of signals that The maximum bandwidth of signals that

digital filter can handle, in real time, is much lower than for digital filter can handle, in real time, is much lower than for analog filters. In real time situations, the analog-digital-analog filters. In real time situations, the analog-digital-analog conversion processes introduce a speed constraint on analog conversion processes introduce a speed constraint on the digital filter performance. The conversion time of the the digital filter performance. The conversion time of the ADC and the settling time of the DAC limit the highest ADC and the settling time of the DAC limit the highest frequency that can be processed. Further, the speed of frequency that can be processed. Further, the speed of operation of a digital filter depends on the speed of the operation of a digital filter depends on the speed of the digital processor used and on number of arithmatic digital processor used and on number of arithmatic operations that must be performed for the filtering algorithm, operations that must be performed for the filtering algorithm, which increases as the filter response is made tighter.which increases as the filter response is made tighter.

Finite Wordlength Effects:Finite Wordlength Effects: Digital filters are subject to Digital filters are subject to ADC noise resulting from quantizing a continuous signal, ADC noise resulting from quantizing a continuous signal, and to roundoff noise incurred during computation. With and to roundoff noise incurred during computation. With higher order recursive filters, the accumulation of roundoff higher order recursive filters, the accumulation of roundoff noise could lead to instability.noise could lead to instability.

Page 6: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

6

Disadvantages of Digital Filters Long Design and Development Times:Long Design and Development Times: The The

design and development times for digital filters, design and development times for digital filters, especially hardware development, can be much especially hardware development, can be much longer than for analog filters. However, once longer than for analog filters. However, once developed the hardware and/or software can be developed the hardware and/or software can be used for other filtering or DSP tasks with little or used for other filtering or DSP tasks with little or no modifications. no modifications.

Page 7: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

7

Filter Design Steps:

Specification of the filter requirements.Specification of the filter requirements. Calculation of suitable filter coefficients.Calculation of suitable filter coefficients. Representation of the filter by a suitable Representation of the filter by a suitable

structure (realization).structure (realization). Analysis of the effects of finite wordlength Analysis of the effects of finite wordlength

on filter performance. on filter performance. Implementation of filter in software and/or Implementation of filter in software and/or

hardware.hardware.

Page 8: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

8

Types of digital filters: FIR and IIR filters

FIR filtersFIR filters IIR filtersIIR filters

Page 9: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

9

Finite Impulse Response (FIR) Filters

Definition:Definition: These filters are represented by the following These filters are represented by the following equation:equation:

The corresponding transfer function of the filter is given byThe corresponding transfer function of the filter is given by

where h[i] are impulse response coefficients, y[n] where h[i] are impulse response coefficients, y[n] is output and x[n] is input of the filter.is output and x[n] is input of the filter.

Alternative Names: Alternative Names: Non-recursive filters, All-zero filters.Non-recursive filters, All-zero filters.

Reason for the name Reason for the name Finite Impulse ResponseFinite Impulse Response filter: the unit filter: the unit impulse response consists of a finite number (M+1) of impulse response consists of a finite number (M+1) of terms, i.e. its duration in real time is finite. (M+1) is called terms, i.e. its duration in real time is finite. (M+1) is called the the filter Length. filter Length.

]in[x]i[h]n[yM

0i

(1)

M

0i

iz]i[h)z(H

(2)

Page 10: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

10

Designing Frequency-Selective FIR Filters

Ideally we wish to realize a Ideally we wish to realize a “brick-wall” “brick-wall” magnitudemagnitude response and a response and a linear phaselinear phase response.response.

In practice we can realize a reasonable In practice we can realize a reasonable approximation to this magnitude response, approximation to this magnitude response, together with a linear phase response.together with a linear phase response.

The design problem may be stated thus:The design problem may be stated thus: Given an Given an ideal/desired frequency response Fideal/desired frequency response Fdd(jw), decide (jw), decide on a filter length and decide on a filter on a filter length and decide on a filter coefficients which will give an actual response coefficients which will give an actual response F(jw) approximating to FF(jw) approximating to Fdd(jw) to within a given (jw) to within a given specification in magnitude and phase.specification in magnitude and phase.

Page 11: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

11

Digital Filters:

A digital filter can be represented by the following A digital filter can be represented by the following equation:equation:

yynn = b = b00xxnn + b + b11xxn-1 n-1 + …. + b+ …. + bMMxxn-M n-M + a+ a11yyn-1n-1 + … + + … + aaPPyyn-P n-P (4)(4)

This equationThis equation Mathematically describes a digital filterMathematically describes a digital filter Can be directly implemented in a computer, Can be directly implemented in a computer,

real time processor, or special purpose real time processor, or special purpose hardware to do the actual filtering.hardware to do the actual filtering.

Design Issues: • Determination of the filter coefficients.• Software / hardware implementation of the filter.

Page 12: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

12

Finite Impulse Response (FIR) Filters

Definition:Definition: These filters have all the a These filters have all the a coefficients zero in equation (4):coefficients zero in equation (4):

yynn = b = b00xxnn + b + b11xxn-1 n-1 + …… + b+ …… + bMMxxn-Mn-M

Alternative Names: Alternative Names: Non-recursive filters, All-Non-recursive filters, All-zero filters.zero filters.

Reason for the name Reason for the name Finite Impulse ResponseFinite Impulse Response filter: the unit impulse response consists of a filter: the unit impulse response consists of a finite number (M+1) of terms, i.e. its duration finite number (M+1) of terms, i.e. its duration in real time is finite. (M+1) is called the in real time is finite. (M+1) is called the filter filter Length. Length.

Page 13: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

13

Designing Frequency-Selective FIR Filters

Ideally we wish to realize a Ideally we wish to realize a “brick-wall” “brick-wall” magnitudemagnitude response and a response and a linear phaselinear phase response.response.

In practice we can realize a reasonable In practice we can realize a reasonable approximation to this magnitude response, approximation to this magnitude response, together with a linear phase response.together with a linear phase response.

The design problem may be stated thus:The design problem may be stated thus: Given an Given an ideal/desired frequency response Fideal/desired frequency response Fdd(jw), decide (jw), decide on a filter length and decide on a filter on a filter length and decide on a filter coefficients which will give an actual response coefficients which will give an actual response F(jw) approximating to FF(jw) approximating to Fdd(jw) to within a given (jw) to within a given specification in magnitude and phase.specification in magnitude and phase.

Page 14: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

14

Design of FIR filter using Fourier MethodsTransform Pair:Transform Pair:

n

jwndd e)w(h)w(H (5)

dwe)w(H

2

1]n[h jwn

dd(6)

To illustrate the method, we try to obtain a design for the ideal low-pass, zero delay filter Hd(w) = 100, -wc < w < wc (7)

= 0, |w| > wc where wc is the cutoff frequency. On substituting this into (6) we get

c

c

w

w

jwnd dwe.1

2

1]n[h (8)

Page 15: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

15

which evaluates to

)nwsin(n

1]n[h cd (9)n = - ….

A filter with the impulse response (8) would realize the ideal specification (7) exactly, However,(a)This impulse response is infinite in length i.e. the filter would require an infinite number of

coefficients. Solution: Truncate to a finite number of coefficients.The response will now be an approximation to theideal. (b) This impulse response is double-sided as shown in the fig on the next slide.If we truncate the series symmetrically, it will have terms for negative k and the filter will be non-causal i.e. will require foreknowledge. It will not be realizable in real time.

Page 16: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

16

-20 -15 -10 -5 0 5 10 15 20

Page 17: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

17

Solution:Solution: Shift the impulse responseShift the impulse response by N by N sampling intervals in time, where N = M/2. On sampling intervals in time, where N = M/2. On denoting the shifted response by h[n], this givesdenoting the shifted response by h[n], this gives

h[n] = hh[n] = hdd(n-N) (10)(n-N) (10)

and now we have a standard finite length and now we have a standard finite length causal filter. causal filter.

This will have the effect of delaying the response This will have the effect of delaying the response by N sampling intervals. Instead of the zero by N sampling intervals. Instead of the zero delay filter of (7), we will have a delay filter of (7), we will have a constant delayconstant delay filter with delay time filter with delay time . This is equivalent to a . This is equivalent to a linear phaselinear phase filter, the phase being given by filter, the phase being given by = = 22ff radians. radians.

On taking account of the truncation and the shift, On taking account of the truncation and the shift, (8) becomes(8) becomes

c

ccc w)Nn(

)w)Nnsin((w)w)Nnsin((

)Nn(

1]n[h

(11)

Page 18: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

18

Shifting of impulse response

0 5 10 15 20 25 30 35 40

Page 19: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

19

The effect of truncation:The effect is to introduce The effect is to introduce Gibbs OscillationsGibbs Oscillations into the into the

frequency response.frequency response.

Reducing the effects of truncation:Reducing the effects of truncation:

Increasing the filter length has relatively little Increasing the filter length has relatively little effect. A better method is to effect. A better method is to windowwindow the the impulse response: each term h[n] is multiplied impulse response: each term h[n] is multiplied by the corresponding term w[n] in a window:by the corresponding term w[n] in a window:

hhww[n] = h[n]w[n] (12)[n] = h[n]w[n] (12)

Many windows have been proposed. Some of Many windows have been proposed. Some of these are described below:these are described below:

Page 20: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

20

Rectangular Window:

The rectangular window is defined asThe rectangular window is defined as

elsewhere0

Mn01]n[w

The filter coefficients b[n] = h[n] can now be computed as

c

ccd w)Nn(

)w)Nnsin((w]n[w]Nn[h]n[h

Example 1: Design a low-pass FIR filter with cut-off frequency at 200 Hz relative to a Nyquist frequency of 1KHz. Use the rectangular window to truncate the impulse response. The length of the filter is 21.

(13)

(14)

Page 21: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

21

Solution: The normalized cut-off frequency iswc = 2fc/fs = 2(200/(1000) = 0.4

c

cc

w)2/Mn(

w2/Mnsinw]n[h

h[0] = 0.0000 = h[20]h[1] = -0.03364 = h[19]h[2] = -0.02339 = h[18]h[3] = 0.02673 = h[17]h[4] = 0.05046 = h[16]h[5] = 0.00000 = h[15]h[6] =-0.07568 = h[14]h[7] =-0.06237 = h[13]h[8] =0.09355 = h[12]h[9] = 0.30273 = h[11]h[10]= 0.40000

0 100 200 300 400 5000

0.2

0.4

0.6

0.8

1

1.2

1.4

Frequency (Hz)

Am

pli

tud

e g

ain

where M = 20

Page 22: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

22

Hamming Window

The Hamming window is defined asThe Hamming window is defined as

1M

n2cos46.054.0]n[w

M-10

1

The filter coefficients can be found as follows: h[n] = hd[n – N]w[n]

1M

n2cos46.054.0

w)Mn(

w)2/Mnsin(w]n[h

c

cc

(15)

(16)

Page 23: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

23

Example 2: Repeat example 1 for a Hamming window.

The filter coefficients can be computed by using equation (16) The filter coefficients can be computed by using equation (16) as:as:

h[0] = 0.00000 = h[20] h[0] = 0.00000 = h[20] The magnitude responseThe magnitude response h[1] = -0.00345 = h[19] h[1] = -0.00345 = h[19] of the filter and itsof the filter and its h[2] = -0.00393 = h[18] h[2] = -0.00393 = h[18] comparison with comparison with h[3] = 0.00721 = h[17] h[3] = 0.00721 = h[17] the magnitude responsethe magnitude response h[4] = 0.02007 = h[16] h[4] = 0.02007 = h[16] of the filter withof the filter with h[5] = 0.00000 = h[15] h[5] = 0.00000 = h[15] rectangular window isrectangular window is h[6] = -0.05163 = h[14] h[6] = -0.05163 = h[14] given in the figure ongiven in the figure on h[7] = -0.05054 = h[13] h[7] = -0.05054 = h[13] the next slide.the next slide. h[8] = 0.08533 = h[12]h[8] = 0.08533 = h[12] h[9] = 0.29592 = h[11]h[9] = 0.29592 = h[11] h[10]= 0.40000 h[10]= 0.40000

Page 24: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

24

0 100 200 300 400 5000

0.2

0.4

0.6

0.8

1

1.2

1.4

Frequency (Hz)

Am

pli

tud

e g

ain

Hamming window

Rectangular window

• Hamming window is better than rectangular window.

Page 25: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

25

Hann Window

The Hann Window is defined asThe Hann Window is defined as

1M

n2cos1]n[w 2

1

0 M-10

1 Yellow = Hamming Red = Hann window

(17)

Page 26: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

26

Example 3: Repeat Example 1 with the Hann Window

Solution: Solution: The coefficients of the filter in this case can be The coefficients of the filter in this case can be computed as follows:computed as follows:

1M

n2cos1

wMn

w2/Mnsinw]n[h 2

1

c

cc

(18)

The coefficients are:

h[0] = 0.00000 = h[20]h[1] = -0.00082 = h[19]h[2] = -0.00223 = h[18]h[3] = 0.00551 = h[17]h[4] = 0.01743 = h[16]h[5] = 0.0000 = h[15]h[6] = -0.04953 = h[14]

h[7] = -0.04951 = h[13]h[8] = 0.08462 = h[12]h[9] = 0.29532 = h[11]h[10] = 0.40000

Page 27: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

27

0 100 200 300 400 5000

0.2

0.4

0.6

0.8

1.2

1.4

Frequency (Hz)

Am

pli

tud

e g

ain

1

Hamming and Hann window

Rectangular window

Page 28: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

28

Kaiser Window

The windows studied so far are very simple, but The windows studied so far are very simple, but do not provide good control over the filter do not provide good control over the filter design specifications. Kaiser window is a highly design specifications. Kaiser window is a highly suitable for achieving the required pass-band suitable for achieving the required pass-band and/or stop-band ripple, along with the cut-off and/or stop-band ripple, along with the cut-off requirements. Consider the following figure.requirements. Consider the following figure.

1-1

Passband ripple

wp ws

2

1+1

wc

Ideal response

Page 29: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

29

The passband/stopband frequencies {wThe passband/stopband frequencies {wpp, w, wss} are } are

related to the ideal cutoff frequency wrelated to the ideal cutoff frequency wcc and and

transition width transition width w byw by

wwcc = ½ (w = ½ (wpp + w + wss), ), w = ww = wss – w – wp p (19)(19)

The passband and stopband overshoots {AThe passband and stopband overshoots {App, A, Ass} }

are expressed in dB asare expressed in dB as

, , 1

110p 1

1log20A

210s log20A (20)

Equation (20) can be inverted to give:

,110

11020/Ap

20/A

1

p

20/A

2s10 (21)

Although 1 and 2 can be specified independently of eachOther, it is a property of all windows designs that the finaldesigned filter will have equal pass-band and stop-band ripples.

Page 30: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

30

Therefore, we must design the filter on the basis Therefore, we must design the filter on the basis of the smaller of the two ripples, that is,of the smaller of the two ripples, that is,

= min(= min(11, , 22) (22)) (22)

The Kaiser window is mathematically The Kaiser window is mathematically represented asrepresented as

2

1M0

2

21M2

21M

0

I

nI

]n[w

(23)

where I0(x) is the modified Bessel function of the first kind And 0th order. The parameter can be computed as follows:

21A0

50A21)21A(5842.0

50A)7.8A(1102.0

(24)

Page 31: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

31

The filter length can be obtained asThe filter length can be obtained as

f

Df1M s

(25)

21A922.0

21AD 36.14

95.7A

(26)

where fs is the sampling frequency in Hz, f is the transitionWidth in Hz and

The shape of the Kaiser window for M = 51 & = 7 is given below:

10 20 30 40 500

1

Page 32: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

32

Example 4: Using Kaiser Window, design a low-pass digital filter with the following specifications:Sampling frequency = 20 KHzpass-band frequency = 4 KHzStop-band frequency = 5 KHzAp = 0.1 dB, As = 80 dB

Solution: Solution: ,0058.0

110

11020/A

20/A

p p

p

0001.010 20/80s

and

Therefore, = min(1, 2), which in db is A = -20log10 = As = 80. = 0.1102(A-8.7) = 7.857, D = (A-7.95)/14.36 = 5.017.The transition width = f = fs – fp = 5 – 4 = 1KHzfc = ½ (fs + fp) = 4.5 KHz, wc = (2fc/fs) = 0.45.M– 1 = Dfs/f M = 103 (M-1)/2 = 102/2 = 51

Page 33: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

33

The windowed impulse response will beThe windowed impulse response will be

2

1M0

2

21M2

21M

0

I

n857.7I

)51n(

)51n(45.0sin]n[h

(27)

Page 34: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

34

Generalized FIR Digital Filter Design:

The windows described above can easily be The windows described above can easily be used to design a High-pass and other used to design a High-pass and other frequency selective filters FIR filter. frequency selective filters FIR filter. Following are the main steps:Following are the main steps:

Define an ideal magnitude response function.Define an ideal magnitude response function. Obtain the ideal (infinite) impulse response Obtain the ideal (infinite) impulse response

sequence hsequence hdd[n]by evaluating the Fourier [n]by evaluating the Fourier inverse transform of the magnitude response inverse transform of the magnitude response of step1.of step1.

Use appropriate delay factor and window to Use appropriate delay factor and window to compute the coefficients of the filter.compute the coefficients of the filter.

Page 35: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

35

High Pass Filter:High Pass Filter: The magnitude response of a normalized ideal high- The magnitude response of a normalized ideal high-pass filter is given bypass filter is given by

c

c2/jwM

d ww00

wwe]n[h (28)

By evaluating the inverse Fourier Transform, we obtain the ideal impulse response sequence

2/Mn

2/Mnwsin

2/Mn

)2/Mn(sin]n[h c

d

(29)

Tutorial Q1: Derive equation (29) from equation (28).

Example 5: Design a high-pass filter with a cutoff frequency of 2.5 KHz and a sample interval of 0.0001 s; The length of the filter is 21 and the rectangular window is used to truncate the ideal impulse response function.

Page 36: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

36

Solution: Solution: The normalized cutoff frequency isThe normalized cutoff frequency is

wwcc = 2500 = 25000.0001 = 0.250.0001 = 0.25

The filter coefficients can be found from equationThe filter coefficients can be found from equation

(29) with M = 20. These coefficients are given below:(29) with M = 20. These coefficients are given below:h[0] = -0.00000 = h[20] h[0] = -0.00000 = h[20]

H[1] = -0.03537 = h[19] The magnitude response is as shown below:H[1] = -0.03537 = h[19] The magnitude response is as shown below:

H[2] = -0.00000 = h[18]H[2] = -0.00000 = h[18]

h[3] = 0.04547 = h[17]h[3] = 0.04547 = h[17]

h[4] = -0.00000 = h[16] h[4] = -0.00000 = h[16]

H[5] = -0.06366 = h[15]H[5] = -0.06366 = h[15]

H[6] = -0.00000 = h[14]H[6] = -0.00000 = h[14]

H[7] = 0.10610 = h[13]H[7] = 0.10610 = h[13]

H[8] = -0.00000 = h[12]H[8] = -0.00000 = h[12]

H[9] = -0.31831 = h[11]H[9] = -0.31831 = h[11]

H[10]= 0.500000 H[10]= 0.500000 0 1 2 3 4 50

1

Frequency (kHz)

Am

pli

tud

e

Page 37: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

37

Band-Pass Filter: The magnitude of an ideal constant delay band-pass filter is given by

elsewhere0

wwwe)w(H HL

2/jwM

d (30)

where wL and wH are the low and high edges of the pass-band and M/2 is the delay.

When Hd(w) of (30) is inverse transformed, we find that the Band-pass impulse response is given by

2/Mn

2/Mnwsin

2/Mn

2/Mnwsin]n[h LH

d

(31)

Tutorial Q2: Derive equation (31) from (30)

Page 38: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

38

Example 6:Design a Band-Pass Digital FIRfilter of length 21. The band edges are specified to be at 1.5 and 3.5 kHz and the sampling interval is 0.0001s. Use the Hamming window.

Solution: Solution: The normalized cutoff frequencies are .15 and 0.35. The normalized cutoff frequencies are .15 and 0.35. The filter coefficients are obtained by multiplying (31) and The filter coefficients are obtained by multiplying (31) and (15) and are given below:(15) and are given below:

h[0] = 0.00000 = h[20] h[8] = -0.27614 = h[12]h[0] = 0.00000 = h[20] h[8] = -0.27614 = h[12] h[1] = -0.00000 = h[19] h[9] = 0.000000 = h[11]h[1] = -0.00000 = h[19] h[9] = 0.000000 = h[11]h[2] = -0.01270 = h[18] h[10] = 0.40000h[2] = -0.01270 = h[18] h[10] = 0.40000h[3] = 0.00000 = h[17]h[3] = 0.00000 = h[17] h[4] = 0.02481 = h[16] h[4] = 0.02481 = h[16] h[5] = 0.00000 =h[15] h[5] = 0.00000 =h[15] h[6] = 0.06381 =h[14] h[6] = 0.06381 =h[14] H[7] = -0.00000 = h[13]H[7] = -0.00000 = h[13]

The magnitude response of theDesigned filter is shown overleaf

Page 39: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

39

0 1 2 3 4 50

0.2

0.4

0.6

0.8

1

1.2

1.4

Frequency (kHz)

Am

pli

tud

e

Page 40: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

40

Band-Stop Filter: The ideal frequency response of a Band-Stop filter is given by

where wwhere wLL and w and wHH now specify the low and high now specify the low and high

edges of the stop-band. Taking the inverse edges of the stop-band. Taking the inverse Fourier transform of (32) yiledsFourier transform of (32) yileds

elsewhere0

wwwwewH H,L

2/jwM

d (32)

2/Mn

2/Mnwsin

2/Mn

2/Mnsin

2/Mn

2/Mnwsin]n[h HL

d

(33)

Example 7: Design a band-stop filter with edges frequenciesAt 1.5 and 3.5 kHz relative to a sample interval of 0.0001.Use Hann window. Length of the filter is 21.Solution: the normalized frequencies are 0.15 and .35. The Filter coefficients can be obtained by multiplying (33) and (17)and are given by

Page 41: 1 Introduction to Digital Filters Filter: A filter is essentially a system or network that selectively changes the wave shape, amplitude/frequency and/or.

41

0 0.00000 7 0.00000 14 -0.061230 0.00000 7 0.00000 14 -0.06123

1 0.00000 8 0.27382 15 0.000001 0.00000 8 0.27382 15 0.00000

2 0.00723 9 0.00000 16 -0.021552 0.00723 9 0.00000 16 -0.02155

3 0.00000 10 0.60000 17 0.000003 0.00000 10 0.60000 17 0.00000

4 -0.02155 11 0.00000 18 0.007234 -0.02155 11 0.00000 18 0.00723

5 0.00000 12 0.27382 19 0.000005 0.00000 12 0.27382 19 0.00000

6 -0.06123 13 0.00000 20 0.000006 -0.06123 13 0.00000 20 0.00000

The magnitude response is as under:

0 1 2 3 4 50

1.4

Am

pli

tud

e