Upload
conrad-thornton
View
218
Download
1
Embed Size (px)
Citation preview
DSP-CIS
Chapter-5: Filter Realization
Marc MoonenDept. E.E./ESAT-STADIUS, KU Leuven
www.esat.kuleuven.be/stadius/
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 2
PART-II : Filter Design/Realization
• Step-1 : Define filter specs
(pass-band, stop-band, optimization criterion,…)
• Step-2 : Derive optimal transfer function
FIR or IIR design
• Step-3 : Filter realization (block scheme/flow graph)
direct form realizations, lattice realizations,…
• Step-4 : Filter implementation (software/hardware)
finite word-length issues, …
question: implemented filter = designed filter ?
‘You can’t always get what you want’ -Jagger/Richards (?)
Chapter-4
Chapter-5
Chapter-6
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 3
Chapter-5 : Filter Realizations
• FIR Filter Realizations
• IIR Filter Realizations
PS: Will always assume real-valued filter coefficients
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 4
Q:Why bother about many different realizations
for one and the same filter?
Chapter-5 : Filter Realizations
A: See Chapter-6 !
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 5
FIR Filter Realizations
FIR Filter Realization
=Construct (realize) LTI system (with delay elements, adders and multipliers), such that I/O behavior is given by..
Several possibilities exist…
1. Direct form
2. Transposed direct form
3. Lattice (LPC lattice)
4. Lossless lattice
PS: Frequency-domain realization: see Part-III
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 6
FIR Filter Realizations
1. Direct form
u[k]
u[k-4]u[k-3]u[k-2]u[k-1]
xbo
+
xb4
xb3
+
xb2
+
xb1
+y[k]
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 7
FIR Filter Realizations
2. Transposed direct form Starting point is direct form :
`Retiming’ = select subgraph (shaded) remove one delay element on all inbound arrows add one delay element on all outbound arrows
u[k]
u[k-4]u[k-3]u[k-2]u[k-1]
xbo
+
xb4
xb3
+
xb2
+
xb1
+y[k]
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 8
FIR Filter Realizations
`Retiming’ : results in...
(=different software/hardware, same i/o-behavior)
u[k]
u[k-1]
xbo
+
xb1
+y[k]
u[k-4]u[k-3]
xb4
xb3
+
xb2
+
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 9
FIR Filter Realizations
`Retiming’ : repeated application results in...
i.e. `transposed direct form’
u[k]
xbo
+y[k]
xb1
+
xb2
+
xb3
+
xb4
(=different software/hardware (`pipeline delays’), same i/o-behavior)
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 10
FIR Filter Realizations
3. Lattice form Derived from combined realization of
with `flipped’ version of H(z)
Reversed (real-valued) coefficient vector results in...
i.e. - same magnitude response - different phase response
212)(...)(
~).(
~)(
~ jjj ezezez
zHzHzHzH
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 11
FIR Filter Realizations
Starting point is direct form realization…
b4
u[k] u[k-1]
u[k-2]
xb3
+
xb2
+
x
+
x
+
b1
u[k-3]
xb1
+
b2 x
+
xb4
+
y[k]
box
+
u[k-4]
xbo
b3 x
y[k]~
Now 1 page of maths…
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 12
FIR Filter Realizations
With this can be rewritten as
order reduction
PS: if |ko|=1, then transformation matrix is rank-deficientPS: find fix for case bo=0
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 13
FIR Filter Realizations
This is equivalent to...
…Now repeat procedure for shaded graph
(=same structure as the one we started from)
u[k] u[k-3]
u[k-2]
xb’3
+
xb’2
+
x
+
x
+
b’o
u[k-2]
xb’1
+
b’1 x
+
b’o
xb’2 x b’3
y[k]
+
+
x
xko
y[k]~
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 14
FIR Filter Realizations
Repeated application results in `lattice form’
u[k]
y[k]
+
+
x
xko
+
+
x
xk1
+
+
x
xk2
+
+
x
xk3
xbo
y[k]~
(= different software/hardware, same i/o-behavior)
explain
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 15
FIR Filter Realizations
• Also known as `LPC Lattice’ (`linear predictive coding lattice’) Ki’s are so-called `reflection coefficients’ Every set of bi’s corresponds to a set of Ki’s, and vice versa.
• Procedure for computing Ki’s from bi’s corresponds to the well-known `Schur-Cohn’ stability test (from control theory):
problem = for a given polynomial B(z), how do we find out if all the zeros of B(z) are stable (i.e. lie inside unit circle) ? solution = from bi’s, compute reflection coefficients Ki’s (following procedure on previous slides). Zeros are (proved to be)
stable if and only if all reflection coefficients statisfy |Ki|<1 !
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 16
FIR Filter Realizations
• Procedure (page 12) breaks down if |Ki|=1 is encountered. Means at least one root of B(z) lies on or outside the unit circle (cfr Schur-Cohn). Then have to select other realization (direct form, lossless lattice, …) for B(z).
• Lattice form is often applied to `minimum phase’ filters, i.e. filters with only stable zeros (roots of B(z) strictly inside unit circle). Then design procedure never breaks down.
• Lattice form not overly relevant at this point, but sets stage for similar derivations that lead to more relevant realizations
(read on…)
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 17
FIR Filter Realizations
4. Lossless lattice : Derived from combined realization of H(z)
with which is such that
(*)
PS : Interpretation ?… (see next slide)
PS : May have to scale H(z) to achieve this (why?) (scaling omitted here)
1)(~~
).(~~
)().( 11 zHzHzHzH
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 18
FIR Filter Realizations
PS : Interpretation ? When evaluated on the unit circle, formula (*) is equivalent to (for filters with real-valued coefficients)
i.e. and are `power complementary’ (= form a 1-input/2-output `lossless’ system, see also below)
1)(~~
)(2
2
jj
ezez
zHzH
)(~~zH)(zH
2
)(~~ jeH
2)( jeH
1
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 19
FIR Filter Realizations
PS : How is computed ?
Note that if zi (and zi*) is a root of R(z), then 1/zi (and 1/zi*) is also a root of R(z). Hence can factorize R(z) as…
Note that zi’s can be selected such that all roots of lie inside the unit circle, i.e. is a minimum-phase FIR filter.
This is referred to as spectral factorization, =spectral factor.
)(~~zH
)(
11 )().(1)(~~
).(~~
zR
zHzHzHzH
)(~~zH
)(~~zH
)(~~zH
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 20
FIR Filter Realizations
Starting point is direct form realization…
u[k] u[k-1]
u[k-2]
x
+
x
+
x
+
x
+
u[k-3]
x
+
x
+
x
+
y[k]
x
+
u[k-4]
x
b1 b2 b3bo b4x
4
~~b0
~~b
1
~~b 2
~~b
3
~~b
y[k]~~
Now 1 page of maths…
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 21
FIR Filter Realizations
From (*) (page 17), it follows that (**)
Hence there exists a rotation angle θo such that
= orthogonal
vectors
order reduction
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 22
FIR Filter Realizations
This is equivalent to...
Now shaded graph can again be proven(***) to be
power complementary system (Intuition? Hint: p.24).
Hence can repeat procedure…
u[k] u[k-3]
u[k-2]
x
+
x
+
x
+
x
+
u[k-2]
x
+
x
+
b’o b’1 b’2 b’3
x
x
y[k]
0cos
+
+
x
x
x
x
0sin
0cos
y[k]~~
0sin
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 23
FIR Filter Realizations
Repeated application results in `lossless lattice’
explain
2cos
+
+
xx
xx
2sin
2cos
2sin
y[k]
0cos
+
+
xx
xx
0sin
0cos
y[k]~~
0sin
u[k]
4sin
4cos
x
x
1cos
+
+
xx
xx
1sin
1cos
1sin
3cos
+
+
xx
xx
3sin
3cos
3sin
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 24
22
21
22
21
2
1
2
1 )()()()(.cossin
sincosOUTOUTININ
IN
IN
OUT
OUT
Lossless lattice :
• Also known as `paraunitary lattice’ (see also Chapter-8)
• Each 2-input/2-output section is based on an orthogonal
transformation, which preserves norm/energy/power
i.e. forms a 2-input/2-output `lossless’ system (=time-domain view).
Overall system is realized as cascade of lossless sections (+delays), hence is itself also `lossless’ (see p.18, =freq-domain view)
FIR Filter Realizations
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 25
FIR Filter Realizations
PS : Can be generalized to 1-input N-output lossless systems (will be used in Part III on filter banks) (compare to p.23 !)
21, u[k]
explain/derive!
x
x
x
y[k]
2cos
+
+
xx
xx
2sin
2cos
2sin1cos
+
+
xx
xx
1cos
1sin1sin
43 , 65 ,
y[k]~
y[k]~~
1)(~~
).(~~
)(~
).(~
)().( 111 zHzHzHzHzHzH
N=
3
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 26
IIR Filter Realizations
Construct LTI system such that I/O behavior is given by..
Several possibilities exist…
1. Direct form
2. Transposed direct form
PS: Parallel and cascade realization
3. Lattice-ladder form
4. Lossless lattice
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 27
IIR Filter Realizations
1. Direct form Starting point is… u[k]
xbo
xb4
xb3
xb2
xb1
+ +++y[k]
+ +++
x-a4
x-a3
x-a2
x-a1
)(
1
zA
)(zB
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 28
IIR Filter Realizations
which is equivalent to...
PS : If all ai=0 (i.e. H(z) is FIR), then this reduces to a direct form FIR
xbo
xb4
xb3
xb2
xb1
+ +++y[k]
u[k] + +++
x-a4
x-a3
x-a2
x-a1
direct form B(z)
)(
1
zA
)(zB
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 29
IIR Filter Realizations
2. Transposed direct form
Starting point is…
)(
1
zA
)(zB
+ +++
x-a4
x-a3
x-a2
x-a1
y[k]
u[k]
xbo
xb4
xb3
xb2
xb1
+ +++
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 30
IIR Filter Realizations
which is equivalent to...
)(
1
zA
)(zB
x-a4
x-a3
x-a2
x-a1
y[k]
u[k]
xbo
xb4
xb3
xb2
xb1
+ +++
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 31
IIR Filter Realizations
Transposed direct form is obtained after retiming ...
PS : If all ai=0 (i.e. H(z) is FIR), then this reduces to a transposed direct form FIR
transposeddirect form B(z)
x-a4
x-a3
x-a2
x-a1
y[k]
u[k]
xbo
xb4
xb3
xb2
xb1
+ +++
)(zB
)(
1
zA
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 32
IIR Filter Realizations
PS: Parallel & Cascade Realization Parallel real. obtained from partial fraction decomposition, e.g. for simple poles:
– similar for the case of multiple poles– each term realized in, e.g., direct form– transmission zeros are realized iff signals from different sections
exactly cancel out. =Problem in finite word-length implementation
u[k]
y[k]
+
+
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 33
IIR Filter Realizations
PS: Parallel & Cascade Realization
Cascade realization obtained from
pole-zero factorization of H(z)
e.g. for L even:
– similar for L odd– each section realized in, e.g., direct form– second-order sections are called `bi-quads’
u[k]
y[k]
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 34
IIR Filter Realizations
• Cascade realization is not unique: - multiple ways of pairing poles and zeros - multiple ways of ordering sections in cascade
• ``Pairing procedure’’ : - pairing of little importance in high-precision (e.g. floating point implementation), but important in fixed-point implementation (with short word-lengths) - principle = pair poles and zeros to produce a frequency response for each section that is as flat as possible (i.e. ratio of max. to min. magnitude response close to unity) - obtained by pairing each pole to a zero as close to it as possible - procedure : start with pole pair nearest to the unit circle, and pair this
to nearest complex zeros. remove pole-zero pair, and repeat, etc….
u[k]
y[k]
Skip this part
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 35
IIR Filter Realizations
3. Lattice-ladder form Derived from combined realization of
with… - numerator polynomial is denominator polynomial with reversed coefficient vector (see also p.10)
- hence is an `all-pass’ (=`SISO lossless’) filter :
)(~zH
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 36
IIR Filter Realizations
Starting point is direct form realization…
u[k]
+ +
x xb1
+
b2 x
+
b0x b3 x b4x xa3 xa2 xa1 x1
xa1 xa2 xa3 xa4
+ + ++
+ + ++
y[k]
y[k]~
a4
x[k]
-
now 2 pages of maths…
will
use
‘sta
te v
ecto
r’
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 37
FIR Filter Realizations
order reduction
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 38
IIR Filter Realizations
If A(z) = stable polynomial (should be!), then the Schur-Cohn test
guarantees that |Ko|<1. Hence define
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 39
IIR Filter Realizations
Then this is equivalent to…
+ +
x x
+
x x
x x x x
+ + +
u[k]
y[k]
y[k]~
b4x
4.41
1.43
aa
aaa
4.41
2.42
aa
aaa
4.41
3.41
aa
aaa
1
x x x
+ ++ -
4.41
3.41
aa
aaa
4.41
2.42
aa
aaa
4.41
1.43
aa
aaa
x
x
x
+
0cos
+
x0sin
0sin
0cos
+
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 40
IIR Filter Realizations
Procedure can be repeated (explain), leads to `lattice-ladder form’
y[k]
b4x
+
b3’x
+
b2’’x
+
b1’’’x
+
x
‘ladd
er p
art’
u[k]
y[k]~
x
x
x
+
0cos
+
x0sin
0sin
0cos
x
x
x
+
+
x
x
x
x
+
+
x
x
x
x
+
+
x
‘latti
ce p
art’
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 41
IIR Filter Realizations
PS: Similar derivation leads to 2nd ‘lattice-ladder’ form
y[k]
b0x
+
b1’x
+
b2’’x
+
b3’’’x
+
x
‘ladd
er p
art’
u[k]
y[k]~
x
x
x
+
0cos
+
x0sin
0sin
0cos
x
x
x
+
+
x
x
x
x
+
+
x
x
x
x
+
+
x
‘latti
ce p
art’
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 42
IIR Filter Realizations
• Ki’s (=sin(thetai) !) are `reflection coefficients’
• Procedure for computing Ki’s from ai’s again corresponds to `Schur-Cohn’ stability test
• Orthogonal transformations correspond to 2-input/2-output `lossless’ sections (=time-domain view).
Cascade of lossless sections (+delays) is also `lossless’,
i.e. `all-pass’ (see p.35, =freq-domain view)
22
21
22
21
2
1
2
1 )()()()(.cossin
sincosOUTOUTININ
IN
IN
OUT
OUT
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 43
IIR Filter Realizations
PS : Note that the all-pass part corresponds to A(z) (i.e. L angles θi correspond to L coeffs
ai) while the ladder part corresponds to B(z). If all ai=0 (i.e. H(z) is FIR), then all θi=0, hence the all-pass part reduces to a delay line, and the lattice-ladder form reduces to a direct-form FIR.
PS : `All-pass’ part (SISO u[k]->y[k]) is known as `Gray-Markel’ structure
u[k]
y[k]~
x
x
x
+
0cos
+
x0sin
0sin
0cos
x
x
x
+
+
x
x
x
x
+
+
x
x
x
x
+
+
x
~
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 44
IIR Filter Realizations
4. Lossless-lattice :
Derived from combined realization of (possibly rescaled, as on p.17)
with...
such that…
(**)
i.e. and are `power complementary’ (p.18-19))(~~zH )(zH
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 45
IIR Filter Realizations
Starting point is direct form realization…
u[k]
+ +
x xb1
+
b2 x
+
b0x b3 x b4x x x x x
xa1 xa2 xa3 xa4
+ + ++
+ + ++
y[k]
y[k]~
x[k]
-
now 2 pages of maths…
will
use
‘sta
te v
ecto
r’
4
~~b0
~~b
1
~~b 2
~~b
3
~~b
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 46
IIR Filter Realizations
PS: right-hand side of (o) has modulus <1 (hence |sinθo|≠1, cosθo≠0) ,
which follows from ‘modulus property’ for (**) p.44:
(should not try to
prove this…)
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 47
IIR Filter Realizations
Now it is proved that From (**) p.44 it follows that (compare to p.21)
This leads to
order reduction
= ‘orthogonal’
vectors
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 48
IIR Filter Realizations Rearranging rows as on p.38, etc.., and repeating the
order-reduction process, leads to…
x
u[k]
y[k]y[k]~
xNsin
Ncos
0cos
+
+
xx
xx
0cos
0sin0sin
x
x
x
+
x
0cos
0cos
0sin
+
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 49
IIR Filter Realizations
• Orthogonal transformations correspond to (3-input 3-output) `lossless sections‘
Overall system is realized as cascade of lossless sections (+delays), hence is itself also `lossless’ (see p.44)
• PS : If all ai=0 (i.e. H(z) is FIR), then all θi=0 and then this reduces to FIR lossless lattice
• PS : If all φi=0, then this reduces to Gray-Markel structure
23
22
21
23
22
21
3
2
1
3
2
1
)()()()()()(
.
...
...
...
OUTOUTOUTINININ
IN
IN
IN
OUT
OUT
OUT
!!
DSP-CIS / Chapter-5: Filter Realization / Version 2014-2015 p. 50
IIR Filter Realizations
PS : Can be generalized to 1-input N-output lossless systems (=combine p.25 & p.48 !)
x
x
x
y[k]
2cos
+
+
xx
xx
2sin
2cos
2sin1cos
+
+
xx
xx
1cos
1sin1sin
y[k]~
y[k]~~
x
x
x
+
x
0cos
0cos
00 sink
0sin
+
u[k]