4. design of discrete-time filters - sjtu in... · conventionally, the design of a discrete-time...

26
4. Design of Discrete-Time Filters 4.1. Introduction (7.0) 4.2. Frame of Design of IIR Filters (7.1) 4.3. Design of IIR Filters by Impulse Invariance (7.1) 4.4. Design of IIR Filters by Bilinear Transformation (7.1) 4.5. Design of FIR Filters by Windowing (7.2)

Upload: others

Post on 02-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

4. Design of Discrete-Time Filters

4.1. Introduction (7.0)

4.2. Frame of Design of IIR Filters (7.1)

4.3. Design of IIR Filters by Impulse Invariance (7.1)

4.4. Design of IIR Filters by Bilinear Transformation (7.1)

4.5. Design of FIR Filters by Windowing (7.2)

Page 2: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

4.1. Introduction

4.1.1. Overview

A discrete-time filter is a discrete-time system which passes some

frequency components and stops others. An ideal discrete-time filter

is best in frequency selectivity. It passes the frequency components in

the pass band distortionlessly and stops the frequency components in

the stop band completely. Unfortunately, it is noncausal and cannot

be implemented in real time. This is undesired in many applications.

In such a case, we need to design a causal discrete-time filter which

approximates the ideal discrete-time filter functionally. The goal of

the design is an impulse response, a frequency response, a system

function, a linear constant-coefficient difference equation or another.

An ideal filter can be approximated by an IIR or FIR filter. An IIR

filter usually needs less cost, i.e., less computation and memory, and

an FIR filter usually has a better performance, especially in the phase

Page 3: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

response. If a generalized linear phase is needed, we usually use an

FIR filter.

4.1.2. Analysis of Ideal Filters

Consider an ideal lowpass filter. The analysis can be extended to

other types of ideal filters.

Over period [, ), the frequency response of an ideal lowpass

filter is defined as

.otherwise ,0

|| ),jexp()(H

c

(4.1)

Let xi(n)=Aiexp(jin) be a frequency component of the input signal.

Then, the corresponding output signal of this filter is

yi(n)=Aiexp(jin)H(i). (4.2)

If |i|c, then

Page 4: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

.

)n(

)n(sin)n(h c

(4.5)

yi(n)=Aiexp[ji(n)], (4.3)

i.e., xi(n) is passed with a constant delay . If |i|>c, then

yi(n)=0, (4.4)

i.e., xi(n) is stopped completely. Thus, the ideal lowpass filter has the

best frequency selectivity.

The impulse response of the ideal lowpass filter is

Since h(n)0 for n<0, the ideal lowpass filter is noncausal and cannot

be implemented in real time. However, in practical applications, a

causal lowpass filter is often required. In such cases, we need to find

a causal lowpass filter which approximates the ideal lowpass filter

functionally. Depending on a specific application, this causal lowpass

filter can be an IIR or FIR filter.

Page 5: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

4.2. Frame of Design of IIR Filters

Conventionally, the design of a discrete-time IIR filter involves a

transform from a continuous-time IIR filter into the discrete-time IIR

filter. It consists of three steps:

1. Find the specifications on the continuous-time IIR filter from

the specifications on the discrete-time IIR filter.

2. Find the system function of the continuous-time IIR filter from

the specifications on the continuous-time IIR filter.

3. Find the system function of the discrete-time IIR filter from the

system function of the continuous-time IIR filter.

There are two typical methods to transform a continuous-time IIR

filter into a discrete-time IIR filter. One is the impulse invariance,

and the other is the bilinear transformation. Next, we will discuss the

two methods.

Page 6: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

4.3. Design of IIR Filters by Impulse Invariance

4.3.1. Definition

A typical method to transform a continuous-time IIR filter into a

discrete-time IIR filter is the impulse invariance. In this method, the

impulse response of the discrete-time IIR filter is obtained by

sampling the impulse response of the corresponding continuous-time

IIR filter, i.e.,

h(n)=Thc(nT). (4.6)

Here, h(n) is the impulse response of the discrete-time IIR filter, hc(t)

is the impulse response of the continuous-time IIR filter, and T is the

sampling interval.

4.3.2. Causality and Stability

If the continuous-time IIR filter has a rational system function and

is causal and stable, the discrete-time IIR filter is causal and stable.

Page 7: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

4.3.3. Frequency Response

If H() and Hc() are the frequency responses of the discrete-time

IIR filter and the continuous-time IIR filter, respectively, then

.mT

2HTH

m

c

(4.7)

t

hc(t)

n

h(n)

Hc()

H(T)

……

Figure 4.1. Relation between H() and Hc() when 2/T>W.

2/T

W

W

Page 8: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

(4.7) shows that H(T) equals Hc() extended with period 2/T. Let

W be the bandwidth of Hc(). If 2/T>W, then H(T) equals Hc()

over the interval [/T, /T) (figure 4.1). Aliasing happens otherwise

(figure 4.2).

The above analysis implies that the impulse invariance can be used

Figure 4.2. Relation between H() and Hc() when 2/TW.

t

hc(t)

n

h(n)

Hc()

H(T)

……

2/T

W

W

Page 9: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

to design band-limited filters, such as lowpass filters and bandpass

filters but cannot be used to design other filters, like highpass filters

and bandstop filters.

4.3.4. Procedure

The impulse invariance is carried out in three steps:

1. Find the specifications on the continuous-time IIR filter from

the specifications on the discrete-time IIR filter according to

=/T, (4.8)

where is the physical frequency of the continuous-time IIR filter,

is the normalized frequency of the discrete-time IIR filter, and T is

the sampling interval.

2. Find the system function of the continuous-time IIR filter from

the specifications on the continuous-time IIR filter.

3. Find the system function of the discrete-time IIR filter from the

Page 10: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

system function of the continuous-time IIR filter. This consists of

three steps: (1) Find the impulse response of the continuous-time IIR

filter from its system function. (2) Find the impulse response of the

discrete-time IIR filter from the impulse response of the continuous-

time IIR filter. (3) Find the system function of the discrete-time IIR

filter from its impulse response.

Example. Design a causal lowpass discrete-time IIR filter with the

cutoff frequency 0.2, i.e.,

,2

1

|)]0j[exp(H|

|)]2.0j[exp(H|

(4.9)

where H(z) is the system function of the filter. A requirement is that

the filter should be generated from a causal lowpass continuous-time

IIR filter

,aRe(s) ,as

a)s(Hc

(4.10)

Page 11: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

where a>0, by the impulse invariance.

4.4. Design of IIR Filters by Bilinear Transformation

4.4.1. Definition

Another typical method to transform a continuous-time IIR filter

into a discrete-time IIR filter is the bilinear transformation. Assume

that H(z) and Hc(s) are the system functions of the discrete-time IIR

filter and the continuous-time IIR filter, respectively. In the bilinear

transformation, H(z) is obtained from Hc(s) by letting

(4.11),z1

z1

T

2s

1

1

that is,

(4.12),z1

z1

T

2H)z(H

1

1

c

Page 12: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

where T is a positive constant.

4.4.2. Causality and Stability

The discrete-time IIR filter is causal and stable if the continuous-

time IIR filter is causal and stable.

4.4.3. Frequency Response

Letting z=exp(j) in (4.12), we obtain

(4.13) .2

tanT

2jH)jexp(H c

(4.13) shows that H[exp(j)] equals Hc(j) when

(4.14)

2tan

T

2

(figure 4.3).

Page 13: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

0

0

H[exp(j)]

0

Hc(

j)

Figure 4.3. Relation between H[exp(j)] and Hc(j).

Aliasing is avoided. However, a nonlinear distortion is caused due

to the nonlinear mapping from to .

… …

… …

3

3

Page 14: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

4.4.4. Procedure

The bilinear transformation is carried out in the following steps:

1. Find the specifications on the continuous-time IIR filter from

the specifications on the discrete-time IIR filter according to (4.14).

2. Find the system function of the continuous-time IIR filter from

the specifications on the continuous-time IIR filter.

3. Find the system function of the discrete-time IIR filter from the

system function of the continuous-time IIR filter according to (4.12).

Example. Design a causal lowpass discrete-time IIR filter which

has the cutoff frequency 0.2, i.e.,

,2

1

|)]0j[exp(H|

|)]2.0j[exp(H|

(4.15)

where H(z) is the system function of the filter. A requirement is that

Page 15: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

the filter should be obtained from a causal lowpass continuous-time

IIR filter

,aRe(s) ,as

a)s(Hc

(4.16)

where a>0, by the bilinear transformation.

4.5. Design of FIR Filters by Windowing

4.5.1. Principle

An ideal filter can be approximated by a causal FIR filter as well.

This can be carried out by different methods. A widely used method

is the windowing method. In this method, the impulse response of

the causal FIR filter is obtained by windowing the impulse response

of the ideal filter.

Let us consider the design of a lowpass filter. The addressed ideas

and methods, however, also apply to other cases.

Page 16: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

.otherwise ,0

|| ),jexp()(H

c

d

(4.17)

.

)n(

)n(sin)n(h c

d

(4.18)

Taking the inverse Fourier transform of Hd(), we obtain the impulse

response of the ideal lowpass filter, i.e.,

Since hd(n)0 for n<0, the ideal lowpass filter is noncausal. However,

windowing hd(n), we can obtain the impulse response of a causal FIR

lowpass filter. That is,

h(n)=hd(n)w(n), (4.19)

where w(n) is a window function and is equal to 0 for n<0. Generally,

In period [, ), the frequency response of an ideal lowpass filter

is defined as

Page 17: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

w(n) is real and symmetric, and has a maximum of 1.

is chosen as

=(N1)/2, (4.20)

where N is the length of w(n). Thus, h(n) is real and symmetric, and

the causal FIR lowpass filter has a generalized linear phase.

4.5.2. Frequency Response

Let W() be the spectrum of w(n). Then the frequency response of

the causal FIR lowpass filter equals the periodic convolution of Hd()

and W() divided by 2, i.e.,

.d)(W)(H2

1)(H

2d

(4.21)

Hd() can be expressed as

Hd()=Ad()exp(j), (4.22)

Page 18: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

where Ad() is the amplitude of Hd(). W() can be expressed as

W()=E()exp(j), (4.23)

where E() is a real function. Substituting (4.22)-(4.23) into (4.21),

we obtain

H()=A()exp(j), (4.24)

where A() is the periodic convolution of Ad() and E() divided by

2, i.e.,

.d)(E)(A2

1)(A

2d

(4.25)

Evidently, A() is also a real function.

From (4.22) and (4.24), we see that the difference between Hd()

and H() is actually the difference between Ad() and A(). Based

on (4.25), there exist two significant differences between Ad() and

A() (figure 4.4).

Page 19: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

Ad()

c n

hd(n)

w(n)

E()

n

h(n)

n

Figure 4.4. Differences between Ad() and A().

A()

c

… …

… …

… …

Page 20: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

1. At each cutoff frequency, Ad() is discontinuous, but A() has a

transition band. (1) The width of the transition band is determined by

the width of the main lobe of E(). In order for A() to have a

narrow transition band, E() should have a narrow main lobe. (2)

The width of the main lobe of E() is determined by both the shape

and the length of w(n). A longer w(n) results in a narrower main lobe.

2. Over the passband and the stopbands, Ad() is equal to 1 and 0

respectively, but A() has ripples. (1) The amplitudes of the ripples

are determined by the areas of the side lobes of E(). In order for

A() to have small-amplitude ripples, E() should have small-area

side lobes. (2) The areas of the side lobes of E() are determined by

the shape of w(n) only.

From (4.24), we have a better understanding about the generalized

linear phase of the causal FIR lowpass filter. It has a strict linear

phase in the passband, which is desired. Its phase is not strictly linear

in the stopbands, but this is trivial.

Page 21: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

4.5.3. Windows

The rectangular window is defined as

.otherwise ,0

1Nn0 ,1)n(w

(4.26)

The Bartlett window is defined as

.

otherwise ,0

1Nn1)/2(N ),1N/(n22

2/)1N(n0 ),1N/(n2

)n(w

(4.27)

The Hann window is defined as

.

otherwise ,0

1Nn0 ,1N

n2cos5.05.0

)n(w

(4.28)

Page 22: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

The Hamming window is defined as

.

otherwise ,0

1Nn0 ,1N

n2cos46.054.0

)n(w

(4.29)

The Blackman window is defined as

.

otherwise ,0

1Nn0 ,1N

n4cos08.0

1N

n2cos5.042.0

)n(w

(4.30)

The above windows are illustrated in figure 4.5.

Table 4.1 gives the features of these windows. When the length of

the window is fixed, a narrow transition band always corresponds to

large-amplitude ripples, and therefore there exists a tradeoff between

the width of the transition band and the amplitudes of the ripples.

Page 23: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

Figure 4.5. Shapes of Commonly Used Windows.

Page 24: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

Shape of

Window

Width of Transition

Band ( in Figure 4.4)

Peak Amplitude

of Ripples

Rectangular 4/N 21 dB

Bartlett 8/(N1) 25 dB

Hann 8/(N1) 44 dB

Hamming 8/(N1) 53 dB

Blackman 12/(N1) 74 dB

Table 4.1. Features of Commonly Used Windows.

The Kaiser window is defined as

.

otherwise 0,

1Nn0 ,)(I

11N

n21I

)n(w

0

2

0

(4.31)

Page 25: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

Here I0(·) is the zero-order modified Bessel function of the first kind

and is a shape parameter.

4.5.4. Procedure

The windowing method is carried out in the following steps:

1. Determine the shape of the window based on the specifications

on the amplitudes of the ripples.

2. Determine the length of the window based on the specifications

on the width of the transition band.

3. Determine based on (4.20).

4. Determine the impulse response of the causal FIR lowpass filter

based on (4.19).

Example. Design a causal FIR lowpass filter. The cutoff frequency

is 0.2. The width of the transition band is less than or equal to 0.01.

Page 26: 4. Design of Discrete-Time Filters - SJTU in... · Conventionally, the design of a discrete-time IIR filter involves a transform from a continuous-time IIR filter into the discrete-time

The amplitudes of the ripples are less than or equal to 0.01.