No Slide Title

Download Report

Transcript No Slide Title

Filtros Digitais
• Diagramas de bloco e grafos de fluxo de sinal
• Estruturas de filtros IIR
• Projeto de filtro FIR
1
6.1.1 Filter Transfer Function
• Linear
constant-coefficient
difference
equations (LCCDEs).
k 1
k 0
k 1
k 0
y[n]   ak y[n  k ]  bk x[n  k ]
N
 y[n]   ak y[n  k ]   bk x[n  k ]
M
K
M
• Taking the two sided Z-transform we have


k 1
 1   ak z 

 k  k  0

N
  bk z k 
H ( z )  H 2 ( z ) H1 ( z )  



1

 M


• 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
2
6.1.2 Block Diagram and Signal Flow Graph
• 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.
Block diagram representation of a firstorder digital filter.
Structure of the signal flow graph.
Structure of the signal flow graph
with the delay branch indicated by z-1.
3
6.1.3 Block Diagram: Direct Form I Realization
v[n ]   bk x[n  k ]
k 0
M
N
y[n]   ak y[n  k ]  v[n]
 k 0

k

V ( z )  H ( z ) X ( z )   b z k  X ( z )
M

k 1
1


k 1
 1   ak z 
k 

N
2
Y ( z )  H ( z )V ( z )  
V ( z )
1




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.
4
6.1.4 Block Diagram: Direct Form II Realization
w[n]   a w[n  k ]  x[n]
k 1
k
N
N
y[n]   bk w[n  k ]


k 1
 1   ak z 
k 

N
2
W ( z)  H ( z) X ( z)  
 X ( z)
1




k 0
 k 0

Y ( z )  H1 ( z )W ( z )    bk z k W ( z )
M

This structure (canonic direct from, direct form II) requires less
delay elements. The minimum number of delays is max(N, M).
5
6.1.5 Example of LTI Implementation
Consider the LTI system with system (transfer) function
1  1.5z 1  0.9 z 2
H ( z) 
1  2 z 1
b0  1, b1  2, a1  1.5, a2  0.9.
we have two implementation as follows
6
6.1.6 Signal Flow Graph: Direct Forms
• Given the LCCDE y[n]   a y[n  k ]  b x[n  k ]
k 1
k 0
k
N
Signal Flow Chart of Direct From I
k
M
Signal Flow Chart of Direct From II
7
6.2.1 Structure of IIR: Cascade Form
• By factoring the numerator and denominator we can write
I
H ( z)   Hi ( z)
i 1
which can be drawn as a cascade of smaller sections:
H1 ( z )
H 2 ( z)

H I (z )
H (z )
• Advantages: Smaller sections – less feedback error.
• Disadvantages: Errors fed from section-to-section.
8
6.2.2 Parallel Realization
• By performing a partial fraction expansion we can write
I
H ( z)   Hi ( z)
i 0
which can be drawn as a parallel sum of smaller sections
H1 ( z )
H1 ( z )

:
H1 ( z )
H (z )
• Advantages: smaller sections- less feedback error, and error
confined to each section.
9
6.2.3 Structure of IIR: Example (Cascade)
1
2
1

2
z

z
Given a two-order system H ( z ) 
1  0.75z 1  0.125z 2
• Cascade Structure (Not unique)
 1  z 1  1  z 1 


H ( z )  
1 
1 
 1  0.5z  1  0.25z 
10
6.2.4 Structure of IIR: Example (Parallel)
1
2
1

2
z

z
Given a two-order system H ( z ) 
1  0.75z 1  0.125z 2
• Parallel Structure (Not unique)
 7  8 z 1
18
25
H ( z)  8 
8

1
2
1
1  0.75z  0.125z
1  0.5z
1  0.25z 1
Parallel-form structure using secondorder system (form I)
Parallel-form structure using
first-order system
11
6.3.1 Digital Filter Design
•
Given a set specifications or stated constraints on
–
–
•
magnitude spectrum H ( e j )
phase spectrum H (e j )
Find {am} and {bk } where,
M
H ( z) 
a
m 0
m
z m
K
1   bk z k
k 1
•
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.
12
6.3.2 Finite Impulse Response (FIR) Filter Design
• Here it is assumed that b1  b2  b3      bK  0
M
• Hence
m
H ( z )   am z
m 0
And so the unit pulse response of the filter is clearly:
an ; 0  n  M
h( n )  
else
 0;
• Problem: Given specifications on H ( e j ) and H (e j ) ,
find {an ; n  1,...,M }
• FIR filters are often called non-recursive for obvious reasons.
13
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.
14
6.3.4 FIR Filter Design: Linear Phase Condition
• Definition: The digital filter
is linear phase if
j
j
H (e )  H (e ) e
jH ( e j )
H (e j )  C for  [ , ]
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
x(n  C)  e jC X (e j )
15
6.3.5 Linear Phase Condition
• Theorem: a causal FIR filter with unit pulse response
h(n)  0; n  0,...,M
is linear phase if h(n) is even symmetric:
Proof: Suppose M is odd. Then
H ( z) 
( M 1) / 2
 h( n ) z
n 0
n
M

 h( n ) z
n
n ( M 1) / 2
( M 1) / 2

j
 H (e )  e
 h( n ) z
n

n 0
( M 1) / 2
 h( M  n ) z
( M  n )
n 0
n
( N  n )
h
(
n
)[
z

z
]

n 0
z e j

( M 1) / 2
 jM / 2
( M 1) / 2
 2h(n) cos[ (n  M / 2)]
n 0
which finishes the proof, why?
• Consider case of M even to be an exercise.
16
6.4.1 FIR Filter Design: Windowing
• Goal: Design an FIR digital filter h(n)  H (e j ) with M+1
coefficients that approximates a desired frequency response
D(e j )  D(e j ) e jD ( e
with
1
d (n) 
2



j
)
D ( e j )e jn d
• Usually d(n) cannot be realized for some reasons.
–
–
–
–
d(n) has infinite duration if D ( e j ) 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.
17
6.4.2 General Windowing Approach
• Define
h(n)  w(n)  d (n)
w(n)  0 for n {0,1,...,M }
• Then designed filter then has frequency response
where
M
H (e )   w(n)  d (n)e  jn
j
n 0
1

2



D(e jv )W [e j ( v ) ]dv where w(n )  W (e j ).
• Observations: We desire conflicting goals
– w(n ) be time-limited to n {0,1,...,M }
– W (e j ) be spectrally localized – impulse-like, if
j
W (e )  2

 (  2n)
then H (e j )  D(e j )
n  
18
6.4.3 Truncation Windowing
• Rectangular window:
1; 0  n  M
w(n)  
else
0;
• The designed filter has frequency response
M
H rec (e )   d (n) w(n)e j  D(e j ) *W (e j )
j
where
n 0
sin[ ( M  1) / 2]  jM / 2
e
 /2
– Is the frequency response Hrec (e j ) a good approximation to the desired
frequency response D(e j ) ?
W (e j ) 
– Actually, for M give Hrec (e j ) is optimal in the mean square sense (MSE).
– However, while rectangular windowing does the best global MSE job, it
suffers dramatically at frequencies.
19
20
6.4.4 Triangle (Bartlett) Windowing
• Suppose that
which
 2n / M ; 0  n  M / 2

w( n )  2  2n / M ; M / 2  n  M

0;
else

2
 sin[ ( M  1) / 4   jM / 2
w( e j )  
2
 e
sin
(

/
4
)


• Note that (ignoring the shift) W (e j ) is a positive function, hence
Htri (e j )  D(e j ) *W (e j )
must rise monotonically at a jump discontinuity (why?).
• In the prior example, using the triangular window gives an
approximation with smooth, but wider transition.
21
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.
22
6.4.6 Other Windows
• Other windows attempt to optimize this trade-off. Widely used
windows that give intermediate results are:
0.54  0.46cos(2n / M ); 0  n  M
w
(
n
)

– Hamming Window:

0;
else

– Hanning Window:
0.5  0.5 cos(2n / M ); 0  n  M
w(n)  
0;
else

– Blackman Window:
0.42  0.5 cos(2n / M )  0.08cos(4n / M ); 0  n  M
w(n)  
0;
else

23
6.4.7 Windowing Comparisons
Rectangular: transition width is optimized.
Blackman: Ripple is minimized.
24
6.4.8 Kaiser Window Design
• Here
 I { 1  [(n   ) /  ]2 }
 0
, 0n M
w(n)  
I0 (  )

0
otherwise

Where   M / 2, and I 0 () 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).
25
26