nonrecursive digital filters. digital filters & filter equation general equation transfer...

36
Nonrecursive Digital Filters

Upload: nancy-rigby

Post on 15-Jan-2016

225 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

Nonrecursive Digital Filters

Page 2: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

Digital Filters & Filter Equation

General Equation

M

kk

N

kk knxbknya

00

][][

M

kk

M

k

kk

M

k

kk

M

kk

jkbHzbzH

zbzXzYknxbny

00

00

)exp()()(

)()(][][

Transfer function

Frequency response

- FIR- Convolution

Page 3: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

• Disadvantage : takes computation time

• Advantage : stable (zeros only)

linear phase (no phase distortion)

same phase shift to all frequencies

M

kk

M

jMM

jjjjjMM

M

Mkk

kbb

Mbbbb

ebebebbebebeb

jkbH

10

210

22101

22

cos2

cos2...2cos2cos2

........

)exp()(

Nonrecursive Filter

Page 4: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

M

kk

M

MM

H

1)cos(21

)12(

1

cos2...2cos2cos21)12(

1)(

Smoothness of the signal correlated to the increment of M

Width of mainlobe negatively correlated to M

increment of M narrow band lowpass filter

2M+1 coefficients, symmetric to n=0

Moving Average Filter

Impulse response of moving average filter

Page 5: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

5-point(M = 2)

No zeros at z=0

since passband around 0

21-point(M = 10)

Frequency Response of Moving Average Filter

Page 6: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

= 0 peak value = 1

unwanted side lobe first side lobe 22% of main lobe

5 terms 4 zeros missing zero at z = 1

21 terms 20 zeros passband contains at = 0

Zeros lie actually on the unit circle true nulls in the corresponding

frequency

ex)

4

234

4321

1

5

1)(

1)(5

1)(

)4()3()2()1()(5

1)(

z

zzzzzH

zzzzzXzY

nxnxnxnxnxny

Frequency Response of Moving Average Filter

Page 7: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

11

)(H1.0

)(sin)sin(1

][

2

)exp()exp(1

)exp()exp(2

1

)exp(

2

1)(exp1

2

1

)exp()(2

1][

11

1

11

11

1

1

1

1

ncnn

nh

j

njnj

n

njnjjn

jn

njdnj

dnjHnh

Ideal Lowpass Filter Method

Page 8: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

)cos()sin(1

][ 01 nnn

nh

1

1 )cos(][2)(k

kkhH

Limit to 2M+1 terms, and start from n=0

M

k

kkhH1

1 )cos(][2|)(|

(bandwidth : center frequency : )12 0

Center frequency :

bandwidth :

00 60

01 30

Lowpass Filter

Replace withkb nh

Design of Highpass/Bandpass Filters using Lowpass Filter

Page 9: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

Cutoff frequency : Sampling rate : KHz100 HzfT s610sec1

2.010

10226

5

s

c f

fT

H

0 2.02.0

nn

nn

nhLP

2.0sin1

sin1

1

Lowpass Filter Design

Page 10: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

Cutoff frequency highpass filter 5.0 H

nn

nnn

nh nHP

5.0sin

11cossin

101

n118000

5.00 HPh 1

1 HPh 02 HPh 31

3HPh

H

0 5.0

Highpass Filter Design

Page 11: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

Cutoff frequency : Sampling rate :

Duration of impulse response :

Hzf 200160 1 Hz800

sec50m

45.0

2

5.04.00

Center frequency

Bandwidth

1.04.05.02 1 05.0

2

1.01

nnn

nhBP

45.0cos205.0sin1

Bandpass Filter Design

Page 12: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

Frequency Transformation

Page 13: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

Recursive Digital Filters

Page 14: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

))()((

))()(()(

321

321

0

0

pzpzpz

zzzzzzK

Za

ZbzH

N

k

kk

M

k

kk

][...]1[][][...]1[][ 1010 MnxbnxbnxbNnyanyanya MN

Recursive filter

powerful : separate control over the numerator and denominator of H(z)

If the magnitude of the denominator becomes small at the appropriate frequency

produce sharp response peaks by arranging

General Form of Filters

Page 15: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

Find the difference equation of Bandpass Filter

(a) Center frequency : = /2, -3dB Bandwidth : /40, Maximum gain : 1(b) No frequency component at = 0, =

- Assume BC is straight line- d = 1 - r (r > 0.9)- 2d = 2 (1-r)- 2 (1-r) [rad] = /40 = 3.14/40, r = 0.961- No frequency component at = 0 and = - two zeroes at z = +1

and -1

05.440

rad r

origin

Example #1

Page 16: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

))()((

))()(()(

321

321

0

0

pzpzpz

zzzzzzK

Za

ZbzH N

k

k

k

M

k

k

k

• -3dB band-width : /40

• Maximum gain : 26.15 (28.35dB)

• in equaiton , K = (6.15)① -1 = 0.03824

2exp961.0

2exp961.0

)1)(1(03824.0

)(

)()(

jzjz

zz

zX

zYzH

9235.0

)1(03824.02

2

z

z

• The corresponding difference equaion is :

y[n+2] + 0.9235y[n] = 0.03824{x[n+2] - x[n]}

subtracting 2 from each term in brackets

y[n] = -0.9235y[n-2] + 0.03824{x[n] - x[n-2]}

Example #1

Page 17: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

Design a band-reject filter which stops 60Hz powerline noise from ECG signal- 10Hz cutoff bandwidth at -3dB point- Poles and zeros as in the picture

(solution) - fs = 1.2 kHz

- fmax : 600Hz

- 2 : 1200 = o: 60

- o (60Hz) = 0.1 97382.0

1201,

600

10)1(2

rr

94833.08523.1

19021.1

94833.0)1.0cos(9476.1

1)1.0cos(2

})1.0(exp97382.0{})1.0(exp97382.0{

})1.0(exp{})1.0(exp{

)(

)()(

2

2

2

2

zz

zz

zz

zz

jzjz

jzjz

zX

zYzH

y[n+2] - 1.8523 y[n+1] + 0.94833 y[n] = x[n+2] - 1.9021 x[n+1] + x[n]

y[n] = 1.8523 y[n-1] - 0.94833 y[n-2] + x[n] - 1.9021 x[n-1] + x[n-2]

Example #2

Page 18: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

Butterworth

Chebyshev – 1st order

Elliptic

Types of Filters

Chebyshev – 2nd order

Page 19: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

2/122/12

1

)2

tan(

)2

tan(1

1|)(|

1

1)(

n

C

nHH

2/1

22

2/1

1

22

)2

tan(

)2

tan(1

1|)(|

1

1)(

Cn

nC

H

C

H

2/1

1

221

1)(

LR

H

n

Butterworth

Chebyshev

Elliptic

analog digital

)()(2)(

)( 1)(

)1(1

21

10

2/12

xCxCxxC

xxCxC

nnn

ripple

Butterworth, Chebyshev, Elliptic Filters

Page 20: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

Find the minimum order of Filter

Cutoff frequency 1= 0.2

Frequency response of less than 30dB at = 0.4

5,29.4,1000236.21

03162.0}236.21{

1

03162.0)20

30(log

}236.21{

1

}]1.0tan2.0tan

[1{

1)4.0(

2

2/12

110

2/122/12

nn

H

n

n

nn

x10log2030

20

30

10

x

2

21

Example #3

Page 21: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

jezjwsz

zs

1

1

H(s) H(z)

0 0

...

...)(

321

321

pspsps

zszszsKsH

Bilinear Transformation

Page 22: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

)2/tan(

)2/tan()2/cos(2

)2/sin(2)(

)(

1

12/2/2/

2/2/2/

w

jj

eee

eee

e

ejw

jjj

jjj

j

j

14

tan2/2

tan

0

0

Bilinear Transformation

Page 23: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

Another method of deriving a digital filter from an analog filter

A sampled version of that of the reference analog filter

Impulse-invariant Filters

Page 24: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

Impulse-invariant Filters

Page 25: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

13

3

2

2

1

1

321

321

)(

)()(

i i

i

ps

K

ps

K

ps

K

ps

K

pspsps

zszszsKsH

Transfer function of

analog filter

Impulse-invariant

filter

Impulse-invariant Filters

Page 26: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

00

0)exp(|)(][

00

0)exp()(

n

nTnpKthnh

t

ttpKth

iinTtii

iii

)exp()exp(1

])[exp()exp()(

1

0

1

0

Tpz

zK

zTp

K

zTnpKzTnpKzH

i

i

i

i

n

nii

n

niii

A zero at the origin of the z-plane

A polse at Tpz iexp

The impulse response of each analog subfilter takes a simple exponential form

For the i-th subfilter

Impulse-invariant Filters

Page 27: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

Design of Recursive Digital Filters

Page 28: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

Nc

LP wwjwH

22

)/(1

1|)(|

2/12 )]/[1(

1|)(|

Nc

LP wwjwH

NLP wjwH

22

1

1|)(|

2/12 )1(

1|)(|

NLP wjwH

or

or

Prototype : when 1c

frequency responses at N = 1, 2, 3

Butterworth LP Analog Filter Design (prototype)

Page 29: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

NNjsNLPLPLPsjsw

sHsHjwH222

2

1

1

1

1|

1

1)()(|)(|

When N : odd

When N : even

kjNN ess 222 101 N

kj

es 2

2

N

kj

k es

kjNN ess 222 101

N

kj

k es 2

2

11

0

0

jes 11

1

1

jes

707.0707.0422

02

0 jeesjj

N = 1 ;

N = 2 ;

N = 3 ; only 3 effective terms

707.0707.0,707.0707.0,707.0707.0 321 jsjsjs

Determination of Poles

Page 30: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

1st order

s

sH

1

1 707.0707.0707.0707.0

1

jsjssH

2nd order

Determination of Poles

Page 31: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

frad 2sec/1

Order of filter

Design a lowpass Butterworth filter : -3dB at 1 rad/sec (prototype filter)

gain of less than 0.1 for the frequency greater than 2 rad/sec

Hzf 159.0

dB201.0log20 10

31.3

2log2

110log

10

10/2010

N 4N

1613.2414.3613.2

1234

ssss

sH LP

a

M dB

N10

10/10

log2

110log

Example

Page 32: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

)(1

1|)(|

222

wCjwH

NLP

or 2

122 )(1

1|)(|

wCjwH

N

LP

N : order, : cutoff frequency, r : ripple amplitude ( : ripple parameter)

11 2)( NNN CCwC

1coscos)( NwCN

210 1log10 dBr

Chebyshev LP Analog Filter Design (prototype)

Order of filter

Page 33: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

Chebyshev Prototype Denominator Polynomials

Page 34: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

Maximum passband ripple : 1dB, Cutoff frequency : less than 1.3 rad/sec

Attenuation in stopband : 40dB for greater than 5 rad/sec

ripple parameter 210 1log10 dBr 2589.02

cutoff frequency : -3dB point is half the magnitude 5.02 jH LP

707.0jH LP

11 2)( NNN CCwC

)(1 wC

12)( 22 wC

5.069.0|)(1

1|)(| 3.12

12

2

wCjwH LP

5.041.0|)(1

1|)(| 3.12

22

2

wCjwH LP 2nd order

Passband characteristic

4352

22

2 10106.1|)(1

1|)(|

wCjwH LP

4552

32

2 10106.1|)(1

1|)(|

wCjwH LP 3rd order

491.0238.1988.0 23

sss

KsH LP

Example

Page 35: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

c

LPLPP

HP

cLPP

BP

BP

LP BP

20

2

20

2

BS

BSLP

BP

c

s

sc

Bs

s 20

2

20

2 s

Bs

form form s

Analog Filter Frequency Transformation

Page 36: Nonrecursive Digital Filters. Digital Filters & Filter Equation General Equation Transfer function Frequency response - FIR - Convolution

Butterworth bandpass filter

Hzfu 900

?of

Hzfl 600

sec/56559002 radu

sec/37706002 radl

sec/1032.21 620 radlu Hzf 735

20

0

sec/1885 radB lu

sec/5026800 radHz sec/1256200 radHz

Prototype equivalent frequency

BP

BP

BP

BP

LP BP

6220

2 1032.21

1885

1

a

M dB

N10

10/10

log2

110log

Filter

order

75.12.0418.0 NM dBa

71.25035.8 NM dBa 3rd order

Maximum attenuation of 0.2dB for

Minimum attenuation of 50dB for

Hzffo 800

Hzf 2000

Example