39
1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR • Exemplos Filtros Digitais

1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

Embed Size (px)

Citation preview

Page 1: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

1

• Diagramas de bloco e grafos de fluxo de sinal

• Estruturas de filtros IIR

• Projeto de filtro FIR

• Projeto de filtro IIR

• Exemplos

Filtros Digitais

Page 2: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

2

• Linear constant-coefficient difference equations (LCCDEs).

• Taking the two sided Z-transform we have

• H(z) is a filter transfer function, and can be used to describe

any digital filter.

– Expressed as a diagram or signal flow graph

– Implemented as a digital circuit

6.1.1 Filter Transfer Function

M

kk

N

kkk n x b k n y a n y

0 1

] [ ] [ ] [

M

kk

K

kkk n x b k n y a n y

0 1

] [ ] [ ] [

M

k

kk N

k

kk

z bz a

z Hz H z H0

1

1 2

1

1) ( ) ( ) (

Page 3: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

3

• A signal flow graph representation of LCCDE is same as a block

diagram, and it is a network of directed branches that connect at

nodes which are variables.

6.1.2 Block Diagram and Signal Flow Graph

Block diagram representation of a first-order digital filter.

Structure of the signal flow graph.

Structure of the signal flow graph with the delay branch indicated by z-1.

Page 4: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

4

6.1.3 Block Diagram: Direct Form I Realization

M

kkk n x b n v

0

] [ ] [

N

kk nvknyany

1

][][][

) ( ) ( ) ( ) (0

1z X z b z X z H z VM

k

kk

) (1

1) ( ) ( ) (

1

2z Vz a

z Vz H z YN

k

kk

This structure (non-canonic, direct form I) can be too sensitive to

finite word-length errors (quantization errors) – errors are summed,

fed back and re-amplified over and over.

Page 5: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

5

6.1.4 Block Diagram: Direct Form II Realization

N

kkn x k n w a n w

1

] [ ] [ ] [

N

kk knwbny

0

][][

) (1

1) ( ) ( ) (

1

2z Xz a

z X z H z WN

k

kk

) ( ) ( ) ( ) (0

1z W z b z Wz H z YM

k

kk

This structure (canonic direct from, direct form II) requires less

delay elements. The minimum number of delays is max(N, M).

Page 6: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

6

6.1.5 Example of LTI Implementation

Consider the LTI system with system (transfer) function

we have two implementation as follows

2 1

1

9. 0 5. 1 1

2 1) (

z z

zz H . 9. 0 , 5. 1 , 2 , 12 1 1 0 a a b b

Page 7: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

7

• Given the LCCDE

6.1.6 Signal Flow Graph: Direct Forms

M

kk

N

kkk n x b k n y a n y

0 1

] [ ] [ ] [Signal Flow Chart of Direct From I Signal Flow Chart of Direct From II

Page 8: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

8

• By factoring the numerator and denominator we can write

which can be drawn as a cascade of smaller sections:

• Advantages: Smaller sections – less feedback error.

• Disadvantages: Errors fed from section-to-section.

6.2.1 Structure of IIR: Cascade Form

I

ii zHzH

1

)()(

)(1 zH )(2 zH )(zH I

)(zH

Page 9: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

9

6.2.2 Parallel Realization

• By performing a partial fraction expansion we can write

which can be drawn as a parallel sum of smaller sections

• Advantages: smaller sections- less feedback error, and error

confined to each section.

I

ii zHzH

0

)()(

)(1 zH

)(1 zH

)(1 zH

:

)(zH

Page 10: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

10

6.2.3 Structure of IIR: Example (Cascade)

Given a two-order system

• Cascade Structure (Not unique)21

21

125.075.01

21)(

zz

zzzH

1

1

1

1

25.01

1

5.01

1)(

z

z

z

zzH

Page 11: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

11

6.2.4 Structure of IIR: Example (Parallel)

Given a two-order system

• Parallel Structure (Not unique)21

21

125.075.01

21)(

zz

zzzH

1121

1

25.01

25

5.01

188

125.075.01

878)(

zzzz

zzH

Parallel-form structure using second-order system (form I)

Parallel-form structure using first-order system

Page 12: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

12

• Given a set specifications or stated constraints on– magnitude spectrum– phase spectrum

• Find where,

• The constraints may include– zero, small, or linear phase– specific bandlimit within a passband– amount of ripple within a passband– amount of ripple within a stopband– sharpness of transitions between passband/stopband– filter order K, M.

6.3.1 Digital Filter Design

)( jeH}{ and }{ km ba

K

k

kk

M

m

mm

zb

zazH

1

0

1)(

)( jeH

Page 13: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

13

• Here it is assumed that• Hence

And so the unit pulse response of the filter is clearly:

• Problem: Given specifications on and ,

find• FIR filters are often called non-recursive for obvious reasons.

0321 Kbbbb

6.3.2 Finite Impulse Response (FIR) Filter Design

M

m

mmzazH

0

)(

else;0

0;)(

Mnanh n

)( jeH )( jeH},...,1;{ Mnan

Page 14: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

14

6.3.3 FIR Filter: Advantages and Disadvantages

• Advantages:– Always stable (assume non-recursive implementation).

– Quantization noise is not much of a problem.

– Can be designed to have exact linear phase even when causal,

while meeting a prescribed phase to arbitrary accuracy.

– Design complexity generally linear.

– Transients have a finite duration.

• Disadvantages:– A high-order filter is generally needed to satisfy the stated

specification – so more coefficients are needed with more

storage and computation.

Page 15: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

15

• Definition: The digital filter

is linear phase if

for some real number C. If C=0, then the filter has zero- phase, which is only possible when the filter is non-causal.

• Achieving linear phase is quite important in applications where is desirable not to distort the signal phase much –i.e., where the frequency locations are critical, such as speech signals.

• Many applications benefit be the linear phase thought as– shaping frequencies according to the magnitude spectrum.

– Time-shifting the response by an amount -C

6.3.4 FIR Filter Design: Linear Phase Condition

)()( jCj eXeCnx

)()()( jeHjjj eeHeH

],[for )( CeH j

Page 16: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

16

• Theorem: a causal FIR filter with unit pulse response

is linear phase if h(n) is even symmetric:

Proof: Suppose M is odd. Then

which finishes the proof, why?

• Consider case of M even to be an exercise.

6.3.5 Linear Phase Condition

2/)1(

0

)( ])[(M

n

nNn zznh

Mnnh ,...,0;0)(

2/)1(

0

)(2/)1(

02/)1(

2/)1(

0

)()()()()(M

n

nMM

n

nM

Mn

nM

n

n znMhznhznhznhzH

2/)1(

0

2/ )]2/(cos[)(2)(M

n

Mjjez MnnheeHj

Page 17: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

17

6.4.1 FIR Filter Design: Windowing• Goal: Design an FIR digital filter with M+1

coefficients that approximates a desired frequency response

with

• Usually d(n) cannot be realized for some reasons.– d(n) has infinite duration if contains discontinuities;

– If d(n) is non-causal and we want it causal;

– If d(n) is longer than can be computed efficiently;

– It’s generally desirable to have few coefficients;

• Windowing is the simplest approach to FIR filter design. One can proceed naively, and thus obtain poor results. But with little care (basic windowing strategies), windowing can be very effective.

)()()( jeDjjj eeDeD

deeDnd njj )(

2

1)(

)()( jeHnh

)( jeD

Page 18: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

18

6.4.2 General Windowing Approach

• Define

where

• Then designed filter then has frequency response

• Observations: We desire conflicting goals

– be time-limited to

– be spectrally localized – impulse-like, if

)()( then)2(2)( jj

n

j eDeHneW

)()()( ndnwnh

},...,1,0{for 0)( Mnnw

njM

n

j endnweH

0

)()()(

).()( where][)(2

1 )(

jvjjv eWnwdveWeD

)( jeW

)(nw },...,1,0{ Mn

Page 19: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

19

6.4.3 Truncation Windowing

• Rectangular window:

• The designed filter has frequency response

where

– Is the frequency response a good approximation to the desired frequency response ?

– Actually, for M give is optimal in the mean square sense (MSE).

– However, while rectangular windowing does the best global MSE job, it suffers dramatically at frequencies.

)(*)()()()(0

jjM

n

jjrec eWeDenwndeH

else

Mnnw

;0

0;1)(

2/

2/

]2/)1(sin[)( Mjj e

MeW

)( jrec eH

)( jeD

)( jrec eH

Page 20: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

20

Page 21: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

21

6.4.4 Triangle (Bartlett) Windowing

• Suppose that

which

• Note that (ignoring the shift) is a positive function, hence

must rise monotonically at a jump discontinuity (why?).

• In the prior example, using the triangular window gives an approximation with smooth, but wider transition.

2/

2

2 )4/(sin

4/)1(sin[)( Mjj e

Mew

else

MnM

Mn

Mn

Mn

nw 2/

2/0

;0

;/22

;/2

)(

)( jeW

)(*)()( jjjtri eWeDeH

Page 22: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

22

6.4.5 Windowing: Trade-off

Ripples vs. Transition Width

• Rectangular window has a sharp transition but severe ripple.

• Triangular window has no ripple but a very wide transition.

Page 23: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

23

6.4.6 Other Windows

• Other windows attempt to optimize this trade-off. Widely used windows that give intermediate results are:

– Hamming Window:

– Hanning Window:

– Blackman Window:

else

MnMnnw

;0

0);/2cos(46.054.0)(

else

MnMnnw

;0

0);/2cos(5.05.0)(

else

MnMnMnnw

;0

0);/4cos(08.0)/2cos(5.042.0)(

Page 24: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

24

6.4.7 Windowing Comparisons

Rectangular: transition width is optimized.Blackman: Ripple is minimized.

Page 25: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

25

6.4.8 Kaiser Window Design

• Here

Where and represents the zeroth-order modified Bessel function of the first kind, and there are two important parameters: M, .

– For M held constant, increasing reduces sidelobe but increase mainlobe width.

– For held constant, increasing M reduces mainlobe width but does not affect sidelobes much.

• Kaiser developed an empirical but careful design procedure for windowing a filter having sharp discontinuity (e.g. an ideal LPF).

otherwise

MnI

nInw

0

0,)(

}]/)[(1{)(

0

20

,2/M )(0 I

Page 26: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

26

Page 27: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

27

• Here it is assumed that

• Problem: Given a desired response , Find:

and

• IIR filters are often called recursive for obvious reason.

• IIR filter advantages: A lower-order filter is generally sufficient to

satisfy the stated specification – so fewer coefficients are needed

(less storage and less computation).

• IIR filter disadvantages: – Not necessarily stable.

– Quantization noise can be a problem.

– Cannot be designed to have exact linear phase when causal.

6.5.1 Infinite Impulse Response (IIR) Filter Design

N

k

kk

M

k

kk

z a

z bz H

1

0

1) (

N k k a,..., 1 ); () (

je D

M k k b,..., 1, 0 ); (

Page 28: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

28

6.5.2 Design of Discrete-Time IIR from Continuous-Time Filters

• The art of continuous-time IIR filter design is highly

advanced.

• Many useful continuous-time IIR filter design methods

have relatively simple closed form design formulas.

• The standard approximation methods that work well for

continuous-time IIR filters do not lead to simple closed-

form design formulas when these methods are applied

directly to the discrete-time IIR case.

Page 29: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

29

6.5.3 Recall Impulse Invariance

• Impulse invariance: a discrete-time system is defined by sampling the impulse response of a continuous-time system by the sampling rate Td, i.e.,

• Relationship between the frequency response of the discrete-time and continuous-time filters

• If the continuous-time filter is band-limited, so that

then

if

) ( ] [d c dnT h T n h

d d kc

j

T

kj

Tj H e H 2

) (

d cT j H/ , 0 ) (

, ) (

dc

j

Tj H e H

. for d T

Page 30: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

30

6.5.4 IIR Filter Design by Impulse Response

• Goal: Approximate a desired discrete-time frequency response by

time-sampling an analog system with impulse response

• If were strictly or effectively band-limited to the low-pass

frequency interval

then can be regarded as equivalent to an ideal digital filter:

). ( ) ( a aH t h

) (a H

s T

) (a H

Page 31: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

31

• Then

or using the ideal relationship between analog and digital frequency

the digital filter that provides the equivalent system is

Thus, in an ideal situation, the desired digital filter could be obtained by

by appropriate selection of .

• Since the analog prototypes cannot be strictly band-limited, the above can only be approximated.

• Impulse invariance is a procedure for obtaining the coefficients of an IIR filter approximating the above relationship.

s

T jd a

Te H H

s

); ( ) (

s T

; ) (

sa

jd

TH e H

sa

j jd

TH e D e H

) ( ) (

)(aH

Page 32: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

32

• Suppose we (scale) and sample the impulse response of a (causal)

analog prototype :

• Then

6.5.5 Sampling the Impulse Response

)(aH ,...., 0 ); ( ] [n nT h T n hd a d

d d kc

j

T

kj

Tj H e H 2

) (

Page 33: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

33

• It is very difficult to compensate for aliasing effects in the impulse invariance approach. Therefore, either sufficiently high sampling rate must be used or another design procedure must be used.

• Assume a sufficiently high sampling rate such that is effectively band-limited to

• Of course the scaled analog prototype must agree satisfactorily with the digital specification by selection of, e.g.,

• Aliasing is an important consideration with impulse invariance design. One common strategy is that no more than 10%, or more stringently, 1% of the energy be aliased.

6.5.6 Aliasing Effect

)(aH

.1

sT

. ); ( ) (

j

sa

jde D

TH e H

sa T

H

)( jeD

.,, Nsp

Page 34: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

34

• Let have L distinct poles (typical for our prototypes):

so

• The sampled filter is then

• The designed digital transfer function is then

• Which is ideal for a parallel realization of first-order section or even better combined into second-order sections.

6.5.7 Implementation of Impulse Invariance Design

L

m m

maa ps

thsH1

)()(

)(aH

step.unit theis )( );()(1

tutueth a

L

ma

tpma

m

) ( ] [d c d dnT h T n h ) (1

L

ms a

nT pm snT u e T

s m ] [

1

L

md

nT pm sn u e T

s m

L

mTp

msd ze

TzHsm

111

)(

Page 35: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

35

6.5.8 Comments on Stability

• If a pole pm of the analog filter lies in the left-hand plane

(LHP), then also

So the corresponding pole of will lie inside the unit

circle. Then the causal filter will be stable.

• Hence the important property

)(aH

10}Re{ smTpm ep

)(zHd

)( Stable)( Stable zHsH da

Page 36: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

36

6.6.1 IIR Filter Design Example-1

• Let us consider the design of a low-pass discrete-time filter by applying impulse invariance to an appropriate Butterworth continuous-time filter. The specifications for the discrete filter are

• For simplicity, in the impulse invariance design, we will take Ts=1, hence we have

• Thus, the specifications on the analog filter are

• Since the magnitude response of an analog Butterworth filter is a monotonic function of frequency, the specifications are simplified into

2.00 ,1)(89125.0 jd eH

0.3 ,17783.0)( jd eH

.

2.00 ,1)(89125.0 jHa

0.3 ,17783.0)( jHa

17783.0)3.0( and )2.0(89125.0 jHjH aa

Page 37: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

37

• Specifically, the magnitude function of a Butterworth filter is

so we need to determine N and to meet the desired specifications

which lead to the equations with equality

• The solutions are and . If we use N=6,

then .

6.6.2 Filter Design Example-2

Ns

c jH2

2

)/(1

1)(

17783.0

13.01 and

89125.0

12.01

2222

N

c

N

c

8858.5N 70474.0c

.7032.0c

Page 38: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

38

6.6.3 Filter Design Example-3

• Given N=6, the 12 poles of the magnitude-squared function

are uniformly distributed in angle

of a circle of . Consequently, the poles of

are the three pole pairs in the left half of the s-plane as

7032.0c

Nc

cc jssHsH

2)/(1

1)()(

)(sHc

Page 39: 1 Diagramas de bloco e grafos de fluxo de sinal Estruturas de filtros IIR Projeto de filtro FIR Projeto de filtro IIR Exemplos Filtros Digitais

39

• From the 6 poles of , we have

• We use a partial fraction expansion, and , we have a parallel form of the digital filter.

• The frequency-response functions of the discrete-time filter is

6.6.4 Filter Design Example-4)(sHc

)4945.03585.1)(4945.09945.0)(4945.03640.0(

12093.0)(

222

sssssssHc

L

mTp

msd ze

TzHsm

111

)(

21

1

21

1

21

1

2570.09972.01

6303.08557.1

3699.00691.11

1455.11428.2

6949.02971.11

4466.02871.0)(

zz

z

zz

z

zz

zzHd