ALaRI2011_Lecture4
Transcript of ALaRI2011_Lecture4
-
8/3/2019 ALaRI2011_Lecture4
1/64
p. 1DSP-II
Lecture 4:
FIR and IIR Filter Realization
Marc Moonen
Dept. E.E./ESAT, K.U.Leuven
www.esat.kuleuven.be/scd/
-
8/3/2019 ALaRI2011_Lecture4
2/64
ALARI/DSP Marc Moonen - Version 2011 p. 2Lecture-4 : FIR and IIR FilterRealization
Filter Design/Realization
Step-1 : define filter specs(pass-band, stop-band, optimization criterion,)
Step-2 : derive optimal transfer funcion
FIR
or IIR
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 ?
Lecture-3
Lecture-4
-
8/3/2019 ALaRI2011_Lecture4
3/64
ALARI/DSP Marc Moonen - Version 2011 p. 3Lecture-4 : FIR and IIR FilterRealization
Lecture 4 : Filter Realizations
FIR Filter Realizations
IIR Filter Realizations
PS: We will assume real-valuedfilter coefficients
-
8/3/2019 ALaRI2011_Lecture4
4/64
ALARI/DSP Marc Moonen - Version 2011 p. 4Lecture-4 : FIR and IIR FilterRealization
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 filter banks
][....]1[.][.][ 10 Nkubkubkubky N !
-
8/3/2019 ALaRI2011_Lecture4
5/64
ALARI/DSP Marc Moonen - Version 2011 p. 5Lecture-4 : FIR and IIR FilterRealization
FIR Filter Realizations
1. Direct form
u[k]
( ( ( (
u[k-4]u[k-3]u[k-2]u[k-1]
x
bo
+
x
b4
x
b3
+
x
b2
+
x
b1
+
y[k]
][....]1[.][.][ 10 Nkubkubkubky N !
-
8/3/2019 ALaRI2011_Lecture4
6/64
ALARI/DSP Marc Moonen - Version 2011 p. 6Lecture-4 : FIR and IIR FilterRealization
FIR Filter Realizations
2. Transposed direct formStarting point is direct form :
`Retiming = select subgraph (shaded)remove one delay element on all inbound arrowsadd one delay element on all outbound arrows
u[k]
( ( ( (
u[k-4]u[k-3]u[k-2]u[k-1]
x
bo
+
x
b4
x
b3
+
x
b2
+
x
b1
+
y[k]
-
8/3/2019 ALaRI2011_Lecture4
7/64
ALARI/DSP Marc Moonen - Version 2011 p. 7Lecture-4 : FIR and IIR FilterRealization
FIR Filter Realizations
`Retiming : results in...
u[k]
(
(
u[k-1]
x
bo
+
x
b1
+y[k]
( (
u[k-3]u[k-2]
x
b4
x
b3
+
x
b2
+
(=different software/hardware, same i/o-behavior)
-
8/3/2019 ALaRI2011_Lecture4
8/64
ALARI/DSP Marc Moonen - Version 2011 p. 8Lecture-4 : FIR and IIR FilterRealization
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, same i/o-behavior)
-
8/3/2019 ALaRI2011_Lecture4
9/64
ALARI/DSP Marc Moonen - Version 2011 p. 9Lecture-4 : FIR and IIR FilterRealization
FIR Filter Realizations
3. Lattice formDerived 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
][....]1[.][.][~:)(.)(~
01
1 NkubkubkubkyzHzzH NNN !!
212)(...)(~).(~)(~ [[[ jjj ezezez
zHzHzHzH!!
!!!!
][....]1[.][.][:)( 10 NkubkubkubkyzH N !
-
8/3/2019 ALaRI2011_Lecture4
10/64
ALARI/DSP Marc Moonen - Version 2011 p. 10Lecture-4 : FIR and IIR FilterRealization
FIR Filter Realizations
Hence starting point is
b4
u[k] u[k-1]
(
u[k-2]
xb3
+
xb2
+
x
+
x
+
b1
u[k-3]
(
xb1
+
b2x
+
xb4
+
(
y[k]
box
+
u[k-4]
(
xbo
b3x
y[k]~
-
8/3/2019 ALaRI2011_Lecture4
11/64
ALARI/DSP Marc Moonen - Version 2011 p. 11Lecture-4 : FIR and IIR FilterRealization
FIR Filter Realizations
With this can be rewritten as(ps: find fix for case bo=0)
? A
? A
2
0
10332
0
20222
0
3011,00
3210
01231
0
0
3210
0123
0
0
1',
1',
1''
]1[]...[.''''
''''
.10
0
.1
1
][]...[.0''''
''''0
1
1
][
][~
O
O
O
O
O
O
O
O
O
O
!
!
!!
-
-
-
!
-
-
!
-
bbb
bbb
bbbbb
Nkukubbbb
bbbbz
Nkukubbbb
bbbb
ky
ky
T
T
? AT
Nkukubbbbb
bbbbb
ky
ky][]...[.
][
][~
43210
01234
-!
-
1if, 00)0(assume
0
40 {! { OO b
b
b
`sloppy notation
-
8/3/2019 ALaRI2011_Lecture4
12/64
ALARI/DSP Marc Moonen - Version 2011 p. 12Lecture-4 : FIR and IIR FilterRealization
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]
xb3
+
xb2
+
x
+
x
+
bo
u[k-2]
(
xb1
+
b1x
+
bo
(
xb2
xb3
y[k]
+
+
x
x ko
y[k]~
(
-
8/3/2019 ALaRI2011_Lecture4
13/64
ALARI/DSP Marc Moonen - Version 2011 p. 13Lecture-4 : FIR and IIR FilterRealization
FIR Filter Realizations
Repeated application results in `lattice formu[k]
y[k]
+
+
x
x
ko
+
+
x
x
k1
( +
+
x
x
k2
+
+
x
x
k3
xbo
y[k]~
(= different software/hardware, same i/o-behavior)
explain
(((
-
8/3/2019 ALaRI2011_Lecture4
14/64
ALARI/DSP Marc Moonen - Version 2011 p. 14Lecture-4 : FIR and IIR FilterRealization
FIR Filter Realizations
Lattice form : Also known as `LPC Lattice (`linear predictive coding lattice)
Kis are so-called `reflection coefficients
Every set of bis corresponds to a set of Kis, and vice versa.
Procedure for computing Kis from bis corresponds to thewell-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 bis, compute reflection coefficients Kis
(following procedure on previous slides). Zeros are (proven to be)
stable if and only if all reflection coefficients statisfy |Ki|
-
8/3/2019 ALaRI2011_Lecture4
15/64
ALARI/DSP Marc Moonen - Version 2011 p. 15Lecture-4 : FIR and IIR FilterRealization
FIR Filter Realizations
Procedure (page 11) breaks down if |Ki|=1 is encountered.Means at least one root of B(z) lies on or outside the unitcircle (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.
filter 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)
-
8/3/2019 ALaRI2011_Lecture4
16/64
ALARI/DSP Marc Moonen - Version 2011 p. 16Lecture-4 : FIR and IIR FilterRealization
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[.~~
][.~~
][~~:)(
~~10 NkubkubkubkyzH N !
][....]1[.][.][:)( 10 NkubkubkubkyzH N !
1)(
~~
).(
~~
)().(11
!
zHzHzHzH
-
8/3/2019 ALaRI2011_Lecture4
17/64
ALARI/DSP Marc Moonen - Version 2011 p. 17Lecture-4 : FIR and IIR FilterRealization
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
TT
2
)(
~~ [jeH
2
)( [jeH
1
-
8/3/2019 ALaRI2011_Lecture4
18/64
ALARI/DSP Marc Moonen - Version 2011 p. 18Lecture-4 : FIR and IIR FilterRealization
FIR Filter Realizations
PS : How is computed ?
Note that if `a is a root ofR(z), then `1/a is also aroot ofR(z). Hence can factorize R(z) as
Note that ais can be selected such that all of them lie inside the
unit circle. Then is a minimum-phase FIR filter.
This is referred to as spectral factorization, =spectral factor.
)(
~~zH
)(
11 )().(1)(~~
).(~~
zR
zHzHzHzH !
! i
ii azazzHzH ))(()(~~
).(~~ 11 !
i
iazzH )()(~~ 1
)(~~zH
)(~~zH
-
8/3/2019 ALaRI2011_Lecture4
19/64
ALARI/DSP Marc Moonen - Version 2011 p. 19Lecture-4 : FIR and IIR FilterRealization
FIR Filter Realizations
Starting point is
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]~~
-
8/3/2019 ALaRI2011_Lecture4
20/64
ALARI/DSP Marc Moonen - Version 2011 p. 20Lecture-4 : FIR and IIR FilterRealization
FIR Filter Realizations
From (*) (page 16), it follows that (prove it)
Hence there exists a theta_0 such that
? A
? AT
T
Nkukubbbb
bbbbz
Nkukubbbb
bbbbkyky
]1[]...[.''''
'~~
'~~
'~~
'~~
.10
0.
cossin
sincos
][]...[.0'''''
~~'
~~'
~~'
~~0
cossinsincos
][][
~~
3210
3210
1
00
00
3210
3210
00
00
-
-
-
!
-
- !
-
UU
UU
UUUU
? AT
Nkukubbbbb
bbbbb
ky
ky ][]...[.
~~
~~
~~
~~
~~
][
][~~
43210
43210
-!
-
-B
-!
4
4
0
04040
~~~~
0.~~.~~bb
bbbbbb
`sloppy notation
-
8/3/2019 ALaRI2011_Lecture4
21/64
ALARI/DSP Marc Moonen - Version 2011 p. 21Lecture-4 : FIR and IIR FilterRealization
FIR Filter Realizations
This is equivalent to...
Now shaded graph can again be proven to be power
complementary system (Why ? Intuition? Hint: page 23).
Hence can repeat procedure
u[k] u[k-3](
u[k-2]
x
+
x
+
x
+
x
+
u[k-2](
x
+
x
+
bo b1 b2 b3
(
x
x
y[k]
0cosU
+
+
x
(x
x
x
0sinU
0cosU
y[k]
~~
0sinU
-
8/3/2019 ALaRI2011_Lecture4
22/64
ALARI/DSP Marc Moonen - Version 2011 p. 22Lecture-4 : FIR and IIR FilterRealization
FIR Filter Realizations
Repeated application results in `lossless lattice explain
2cosU
+
+
xx
x
x
2sinU
2cosU
2sinU
y[k]
0cosU
+
+
xx
x
x
0sinU
0cosU
y[k]~~
0sinU
(
u[k]
4sinU
4cosU
x
x
1cosU
+
+
xx
x
x
1sinU
1cosU
1sinU
((
3cosU
+
+
xx
x
x
3sinU
3cosU
3sinU
(
-
8/3/2019 ALaRI2011_Lecture4
23/64
ALARI/DSP Marc Moonen - Version 2011 p. 23Lecture-4 : FIR and IIR FilterRealization
Lossless lattice :
also known as `paraunitary lattice (see also Lecture 6)
each 2-input/2-output section is based on an orthogonaltransformation, which preserves norm/energy/power
i.e. forms a 2-input/2-output `lossless system.
Overall system is realized as cascade of lossless sections,
hence is itself also `lossless (see also next slides)
FIR Filter Realizations
2
2
2
1
2
2
2
1
2
1
2
1)()()()(.
cossin
sincosOUTOUTININ
IN
IN
OUT
OUT!
-
-
!
-
UU
UU
-
8/3/2019 ALaRI2011_Lecture4
24/64
ALARI/DSP Marc Moonen - Version 2011 p. 24Lecture-4 : FIR and IIR FilterRealization
FIR Filter Realizations
State-space descriptionExample 2nd-order system :
- R is `realization matrix (A-B-C-D-matrix) for 1-input/2-output system
- R is orthogonal ! Orthogonality implies losslessness (see next slide)
verify!
2
][
][2
][1
2
][
][~~
]1[2
]1[1
2
1
2
2
11
11
00
00
2
1
hence
100
010
001
.
][][
][
.
cos00
010
001sin00
.
cos0sin0
0100
sin0cos00001
.
cossin00
sincos00
00100001
][
][~~
]1[
]1[
-
!
-
-
!
-
-
-
-
!
-
ku
kx
kx
ky
ky
kx
kx
T
R
RR
kukx
kx
ky
ky
kx
kx
U
U
UU
UU
UU
UU
!!
1cosU
+
+
x
x
x
x
][1 kx
y[k]
0cosU
+
+
x
x
x
x
y[k]~~ u[k]2cosU
x
x((
][2kx
-
8/3/2019 ALaRI2011_Lecture4
25/64
ALARI/DSP Marc Moonen - Version 2011 p. 25Lecture-4 : FIR and IIR FilterRealization
FIR Filter Realizations
Orthogonality ofR implies `losslessness :assume initial internal state is x1[0], x2[0] (2nd order example)
input sequence is u[0],u[1],u[2],,u[L]
corresponding output sequences are y[0],y[1], and y[0],y[1],...
then orthogonality implies that
`energy in initial states + inputs = `energy in final states + outputs
Equivalent transfer function based property (L=infinity) is
i.e. H(z) is `embedded in 1-input/2-output
lossless system (see page 17)
][~~...]0[
~~][...]0[]1[]1[
][...]1[]0[]0[]0[
22222
2
2
1
2222
2
2
1
LyyLyyLxLx
Luuuxx
!
1)(~~
)(2
2
!!
! [[
jj
ezez
zHzH
~~~~
-
8/3/2019 ALaRI2011_Lecture4
26/64
ALARI/DSP Marc Moonen - Version 2011 p. 26Lecture-4 : FIR and IIR FilterRealization
FIR Filter Realizations
PS : Relevance of lattice realizations : robustnessexample :
o = original transfer function
+ = transfer function after 8-bit
truncation of lattice filter
parameters
- = transfer function after 8-bit
truncation of direct-form
coefficients (bis)
PS : A 2x2 orthogonal transformation (rotation) may be implemented inhardware based on a so-called `CORDIC (`COR for CO-ordinate
Rotation) architecture, which is more efficient (and more robust) than a
multiply-add based implementation
-
8/3/2019 ALaRI2011_Lecture4
27/64
ALARI/DSP Marc Moonen - Version 2011 p. 27Lecture-4 : FIR and IIR FilterRealization
FIR Filter Realizations
PS : can be generalized to 1-input M-output lossless systems(will be used in part II on filter banks) (compare to page 22 !)
21,UU u[k]
explain/derive!
x
x
x
y[k]
(
2cosU
+
+
x
x
x
x
2sinU
2cosU
2sinU
1cosU
+
+
x
x
x
x
1cosU
1sinU
1sinU
43,UU 65 ,UU
(
y[k]~
y[k]~~
(
1)(
~
~).(
~
~)(~).(~)().( 111 ! zHzHzHzHzHzH
M
=3
-
8/3/2019 ALaRI2011_Lecture4
28/64
ALARI/DSP Marc Moonen - Version 2011 p. 28Lecture-4 : FIR and IIR FilterRealization
IIR Filter Realizations
ConstructLT
I 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
PS: State space realizations
N
N
N
N
zaza
zbzbb
zA
zBzH
!!...1
...
)(
)()(
1
1
1
10
-
8/3/2019 ALaRI2011_Lecture4
29/64
ALARI/DSP Marc Moonen - Version 2011 p. 29Lecture-4 : FIR and IIR FilterRealization
IIR Filter Realizations
1. Direct formStarting point is u[k]
( ( ( (
xbo xb4xb3xb2xb1
+ +++y[k]
( ( ( (
+ +++
x-a4
x-a3
x-a2
x-a1
)(
1
zA
)(zB
N
N
N
N
zaza
zbzbb
zA
zBzH
!!
...1
...
)(
)()(
1
1
1
10
-
8/3/2019 ALaRI2011_Lecture4
30/64
ALARI/DSP Marc Moonen - Version 2011 p. 30Lecture-4 : FIR and IIR FilterRealization
IIR Filter Realizations
which is equivalent to...
PS : If all a_i=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
-
8/3/2019 ALaRI2011_Lecture4
31/64
ALARI/DSP Marc Moonen - Version 2011 p. 31Lecture-4 : FIR and IIR FilterRealization
IIR Filter Realizations
-State-space description:
-N delay elements (=minimum number =max of numerator anddenominator polynomial order = max(p,q))
-2N+1 multipliers, 2N adders (=minimum number)
? A ][.
][
][
][
][
.....][
][.
0
0
0
1
][
][
][
][
.
0100
0010
0001
]1[
]1[
]1[
]1[
0
4
3
2
1
044033022011
4
3
2
13321
4
3
2
1
kub
kx
kx
kx
kx
babbabbabbabky
ku
kx
kx
kx
kxaaaa
kx
kx
kx
kx
-
!
-
-
-
!
-
u[k]
( ( ( (
xbo
xb4
xb3
xb2
xb1
+ +++
y[k]
+ +++
x-a4
x-a3
x-a2
x-a1
x1[k] x2[k] x3[k] x4[k]
-
8/3/2019 ALaRI2011_Lecture4
32/64
ALARI/DSP Marc Moonen - Version 2011 p. 32Lecture-4 : FIR and IIR FilterRealization
IIR Filter Realizations
2. Transposed direct formStarting point is
N
N
N
N
zaza
zbzbb
zA
zBzH
!!...1
...
)(
)()(
1
1
1
10
)(
1
zA
)(zB
+ +++
( ( ( (
x-a4
x-a3
x-a2
x-a1
y[k]
u[k]( ( ( (
x
bo
x
b4
x
b3
x
b2
x
b1
+ +++
-
8/3/2019 ALaRI2011_Lecture4
33/64
ALARI/DSP Marc Moonen - Version 2011 p. 33Lecture-4 : FIR and IIR FilterRealization
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
+ +++
-
8/3/2019 ALaRI2011_Lecture4
34/64
ALARI/DSP Marc Moonen - Version 2011 p. 34Lecture-4 : FIR and IIR FilterRealization
IIR Filter Realizations
Transposed direct form is obtained after retiming ...
PS : If all a_i=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
-
8/3/2019 ALaRI2011_Lecture4
35/64
ALARI/DSP Marc Moonen - Version 2011 p. 35Lecture-4 : FIR and IIR FilterRealization
IIR Filter Realizations
- State-space description
i.e. direct forms state space matrices are `transpose of
each other (which justifies the name `transposed dir.form).
? A ][.
][
][
][
][
.0001][
][.
.
.
.
.
][
][
][
][
.
000
100
010
001
]1[
]1[
]1[
]1[
0
4
3
2
1
044
033
022
011
4
3
2
1
4
3
2
1
4
3
2
1
kub
kx
kx
kx
kx
ky
ku
bab
bab
bab
bab
kx
kx
kx
kx
a
a
a
a
kx
kx
kx
kx
-
!
-
-
-
!
-
u[k]
( ( ( (
x-a4
x-a3
x-a2
x-a1
y[k]
xbo
xb4
xb3
xb2
xb1
+ +++
x1[k] x2[k] x3[k] x4[k]
T
DC
BA
DC
BA
formdirectTransposedformDirect
-
!
-
-
8/3/2019 ALaRI2011_Lecture4
36/64
ALARI/DSP Marc Moonen - Version 2011 p. 36Lecture-4 : FIR and IIR FilterRealization
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 sectionsexactly cancel out.
=Problem in finite word-length implementation
!
! !!
21
121
1
1
1
110 11)(
)()(
N
i N
i
N
i i
i
zzz
zc
zAzBzH
JIHK
FE
u[k]
y[k]
+
+
-
8/3/2019 ALaRI2011_Lecture4
37/64
ALARI/DSP Marc Moonen - Version 2011 p. 37Lecture-4 : FIR and IIR FilterRealization
IIR Filter Realizations
PS: Parallel & Cascade Realization
Cascade realization obtained from
pole-zero factorization of H(z)
e.g. for N even:
similar for N odd
each section realized in, e.g., direct form
second-order sections are called bi-quads
!
!!2/
121
21
0..1
..1.
)(
)()(
N
i ii
ii
zz
zzb
zA
zBzH
HK
FE
u[k]
y[k]
-
8/3/2019 ALaRI2011_Lecture4
38/64
ALARI/DSP Marc Moonen - Version 2011 p. 38Lecture-4 : FIR and IIR FilterRealization
IIR Filter Realizations
Cascade realization is non-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]
-
8/3/2019 ALaRI2011_Lecture4
39/64
ALARI/DSP Marc Moonen - Version 2011 p. 39Lecture-4 : FIR and IIR FilterRealization
IIR Filter Realizations
3. Lattice-ladder formDerived from combined realization of
with...
- numerator polynomial is denominator polynomial with
reversed coefficient vector(see also page 9)- hence is an `all-pass (=`SISO lossless) filter :
N
N
N
N
zaza
zbzbb
zA
zBzH
!!...1
...
)(
)()(
1
1
1
10
N
N
N
NN
zaza
zzaa
zA
zAzH
!!...1
.1...
)(
)(~
)(~
1
1
1
1
1
)(
)(~
)(~
2
2
2
!!
!
!
!
[
[
[
j
j
j
ez
ez
ez
zA
zAzH
)(~zH
-
8/3/2019 ALaRI2011_Lecture4
40/64
ALARI/DSP Marc Moonen - Version 2011 p. 40Lecture-4 : FIR and IIR FilterRealization
IIR Filter Realizations
Starting point is
u[k]
+ +
x xb1
+
b2 x
+
b0x b3 x b4x x
a3x
a2x
a1x
1
( (( (
xa1 xa2 xa3 xa4
+ + ++
+ + ++
y[k]
y[k]~
a4
x[k]
-
-
8/3/2019 ALaRI2011_Lecture4
41/64
ALARI/DSP Marc Moonen - Version 2011 p. 41Lecture-4 : FIR and IIR FilterRealization
IIR Filter Realizations
This is equivalent to
+ +
x x
+
x x
x x x x
( (
(
(
+ + +
x[k-1]
x
xu[k]
b0
y[k]
y[k]~
x
+
x
0cosU
4.41
1.43
aa
aaa
4.41
2.42
aa
aaa
4.41
3.41
aa
aaa
1
4.41
1.01
aa
abb
4.41
2.02
aa
abb
4.41
3.03
aa
abb
4.41
4.04
aa
abb
+
x
x x x
+ ++-
4.41
3.41
aa
aaa
4.41
2.42
aa
aaa
4.41
1.43
aa
aaa
0sinU
0sinU
0cosU
04
01
sin ka (
!!U
prove it !
+
-
8/3/2019 ALaRI2011_Lecture4
42/64
ALARI/DSP Marc Moonen - Version 2011 p. 42Lecture-4 : FIR and IIR FilterRealization
IIR Filter Realizations
Right-hand part has the same structure as what we started
from, hence procedure can be repeated.
Repeated application leads to lattice-ladder form
u[k]
y[k]
y[k]~ x
x
x
+
x
+
0cosU
+
x
0cosU
0sinU
0sinUbo
( ( ( (
x
-
8/3/2019 ALaRI2011_Lecture4
43/64
ALARI/DSP Marc Moonen - Version 2011 p. 43Lecture-4 : FIR and IIR FilterRealization
IIR Filter Realizations
Lattice-Ladder form : Kis are `reflection coefficients
Procedure for computing Kis (=sin(theta_i) !) from ais again
corresponds to `Schur-Cohn stability test(cfr. supra):
all zeros ofA(z) are stable (i.e. lie inside unit circle)
iff all reflection coefficients statisfy |Ki|
-
8/3/2019 ALaRI2011_Lecture4
44/64
ALARI/DSP Marc Moonen - Version 2011 p. 44Lecture-4 : FIR and IIR FilterRealization
IIR Filter Realizations
State-space description
Example: 2nd-order system:
- R is `realization matrix (A-B-C-D-matrix) for u[k] -> y[k] (SISO)- R is orthogonal (R^T.R=I), which implies `losslessness , i.e.
(cfr. page 39)
? A
-
!
-
!
-
-
-
!
-
100
010
001
.
][
][
][
.][
and
][
][
][
.
100
0sincos
0cossin
.
sincos0
cossin0
001
][~]1[
]1[
2
1
012
2
1
11
11
00
002
1
RR
ku
kx
kx
ky
ku
kx
kx
ky
kx
kx
T
R
EEE
UU
UU
UU
UU
~
1)(~ 2
!! [jez
zH
!!
verify!
-
8/3/2019 ALaRI2011_Lecture4
45/64
ALARI/DSP Marc Moonen - Version 2011 p. 45Lecture-4 : FIR and IIR FilterRealization
IIR Filter Realizations
PS : Note that the all-pass part corresponds toA
(z) (i.e. N angles theta_icorrespond to N coefficients a_i), while the ladder part corresponds to
B(z). If all a_i=0 (i.e. H(z) is FIR), then all theta_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
( ( ( (
x
x
x
+
0cosU
+
x0cosU
0sinU
0sinU
in
out
-
8/3/2019 ALaRI2011_Lecture4
46/64
ALARI/DSP Marc Moonen - Version 2011 p. 46Lecture-4 : FIR and IIR FilterRealization
IIR Filter Realizations
4. Lossless-lattice :Derived from combined realization of(possibly rescaled, as on page 16)
with...
- numerator polynomial is C(z) is such that
i.e. and are `power complementary (p.17-18)
N
N
N
N
zaza
zbzbb
zA
zBzH
!!...1
...
)(
)()(
1
1
1
10
N
N
N
N
zaza
zczcc
zA
zCzH
!!...1
....
)(
)()(
~~1
1
1
10
)(~~zH )(zH
)().()().()().(1)(
~~
).(
~~
)().(111
11
!!
zAzAzCzCzBzBzHzHzHzH
-
8/3/2019 ALaRI2011_Lecture4
47/64
ALARI/DSP Marc Moonen - Version 2011 p. 47Lecture-4 : FIR and IIR FilterRealization
IIR Filter Realizations
`Lossless-lattice :similar derivation (but more complicated -hence skipped) leads to
( ( (
x
u[k]
y[k]y[k]~
xN
]sin
N]cos
0cos]
+
+
x
x
xx
0cos]
0sin]
0sin]
x
x
x
+
x
0cosU
0cosU
00 sinU!k
0sinU
+
-
8/3/2019 ALaRI2011_Lecture4
48/64
ALARI/DSP Marc Moonen - Version 2011 p. 48Lecture-4 : FIR and IIR FilterRealization
IIR Filter Realizations
Orthogonal transformations correspond to (3-input 3-output)`lossless sections
State-space description with orthogonal realization matrix R(try it) implies overall lossless characteristic, i.e.
(cfr. Page 46)
PS : If all a_i=0 (i.e. H(z) is FIR), then all theta_i=0 and then this reducesto FIR lossless lattice
PS : If all phi_i=0, then this reduces to (retimed) Gray-Markel structure
2
3
2
2
2
1
2
3
2
2
2
1
3
2
1
3
2
1
)()()()()()(
.
...
...
...
OUTOUTOUTINININ
IN
IN
IN
OUT
OUT
OUT
!
-
-
!
-
1)(~~
)(2
2
!!
! [[
jj
ezez
zHzH
!!
-
8/3/2019 ALaRI2011_Lecture4
49/64
ALARI/DSP Marc Moonen - Version 2011 p. 49Lecture-4 : FIR and IIR FilterRealization
IIR Filter Realizations
PS : can be generalized to 1-input M-output lossless systems
(=combine p.27 & p.47 !)
x
x
x
y[k]
(
2cosU
+
+
x
x
x
x
2sinU
2cosU
2sinU
1cosU
+
+
x
x
x
x
1cosU
1sinU
1sinU
(
y[k]~
y[k]~~
x
x
x
+
x
0cosU
0cosU
00 sinU!k
0sinU
+
u[k]
-
8/3/2019 ALaRI2011_Lecture4
50/64
ALARI/DSP Marc Moonen - Version 2011 p. 50Lecture-4 : FIR and IIR FilterRealization
IIR Filter Realizations
State-space Realizations : State-space description:
State-space realization = realization such that all the
elements ofA,B,C,D are the multiplier coefficients in thestructure
Example: (transposed) direct form is NOT a state-space realization, cfr.
elements (bi-bo.ai) in B or C (page 31 & 35)
][.][.][
][.][.]1[
kuDkxCky
kuBkxAkx
!
!
(+
+
CB
y[k]
u[k]
D
A
N
-
8/3/2019 ALaRI2011_Lecture4
51/64
ALARI/DSP Marc Moonen - Version 2011 p. 51Lecture-4 : FIR and IIR FilterRealization
IIR Filter Realizations
Example: bi-quad `coupled realization- direct form realization of bi-quad (2nd order IIR) may be unsatisfactory,
e.g. for short word-lengths and poles near z=1 or z=-1 (see lecture-4)
- alternative realization:
state space description :
? A ][][
][.][
][.0
1
][
][.
]1[
]1[
2
1
2
1
2
1
kukx
kxky
kukx
kx
kx
kx
-
!
-
-
-
!
-
PO
LQ
QL
21
21
..1..1)(
!
zzzzzH
ii
iii
HKFE
poles : QL .js
(
(
+
+ +
O
L
Q
P
L
Q
-
y[k]
u[k]
-
8/3/2019 ALaRI2011_Lecture4
52/64
ALARI/DSP Marc Moonen - Version 2011 p. 52Lecture-4 : FIR and IIR FilterRealization
IIR Filter Realizations
State-space description/realization is non-unique:any non-singular matrix T transforms A,B,C,D into an alternative state-spacedescription/realization
with
State-space realization with orthogonal realization matrix is
referred to as `orthogonal filter :
Relevance : implementation aspects
][.~
][~.~
][
][.~
][~.~
]1[~
kuDkxCky
kuBkxAkx
!
!
][.][~
10
0..
10
0~~
~~
1
1
kxTkx
T
DC
BAT
DC
BA
!
-
-
-
!
-
IRRRR
DC
BAR
TT !!
-!
..
-
8/3/2019 ALaRI2011_Lecture4
53/64
ALARI/DSP Marc Moonen - Version 2011 p. 53Lecture-4 : FIR and IIR FilterRealization
Addendum: Filter Implementation
The finite word-length problem : So far assumed all signals/coefficients (=numbers) are
represented exactly and arithmetic operations can be
performed to an infinite precision.
In practice, numbers can be represented only to a finiteprecision, and arithmetic operations are subject to errors
(truncation/rounding/...)
Issues:
- quantization of filter coefficients
- quantization & overflow in arithmetic operations
We considerfixed-point filter implementations, with a
`short word-length.
-
8/3/2019 ALaRI2011_Lecture4
54/64
ALARI/DSP Marc Moonen - Version 2011 p. 54Lecture-4 : FIR and IIR FilterRealization
Filter Implementation : Coefficient Quantization
In signal processors with a `sufficiently long word-length,e.g. with 16 bits (=4 decimal digits) or 24 bits (=7 decimal
digits) precision, or with floating-point representations and
arithmetic, finite word-length issues are less relevant.
The coefficient quantization problem :
Filter design in Matlab (e.g.) provides filter coefficients to
15 decimal digits (such that filter meets specifications)
For implementation, need to quantize coefficients to the
word length used for the implementation.
As a result, implemented filter may fail to meet
specifications ??
-
8/3/2019 ALaRI2011_Lecture4
55/64
ALARI/DSP Marc Moonen - Version 2011 p. 55Lecture-4 : FIR and IIR FilterRealization
Filter Implementation : Coefficient Quantization
Coefficient quantization effect on pole locations : example : 2nd-order system (e.g. for cascade realization)
`triangle of stability : denominator polynomial is stable (i.e.
roots inside unit circle) iff coefficients lie inside triangle
proof: apply Schur-Cohn stability test (cfr. supra). Stable iff all |ki|
-
8/3/2019 ALaRI2011_Lecture4
56/64
ALARI/DSP Marc Moonen - Version 2011 p. 56Lecture-4 : FIR and IIR FilterRealization
Filter Implementation : Coefficient Quantization
example (continued) :with 5 bits per coefficient, all possible `quantized pole positions are...
Low density of `quantized pole locations at z=1, z=-1, hence problem
for narrow-band LP and HP filters (cfr. supra).
- 1 . 5 - 1 - 0 . 5 0 0 . 5 1 1 . 5- 1 . 5
- 1
- 0 . 5
0
0 . 5
1
1 . 5
end
end)plot(roots
1:0625.0:1for
2:1250.0:2for
!
!
i
i
H
K
-
8/3/2019 ALaRI2011_Lecture4
57/64
ALARI/DSP Marc Moonen - Version 2011 p. 57Lecture-4 : FIR and IIR FilterRealization
Filter Implementation : Coefficient Quantization
example (continued) :
possible remedy: `coupled realization
poles are where are realized/quantized
hence `quantized pole locations are (5 bits) :
- 1 . 5 - 1 - 0 . 5 0 0 . 5 1 1 . 5- 1 . 5
- 1
- 0 . 5
0
0 . 5
1
1 . 5
QL .js QL,
(
(
+
+ +
O
L
Q
PL
Q
-
y[k]
u[k]
-
8/3/2019 ALaRI2011_Lecture4
58/64
ALARI/DSP Marc Moonen - Version 2011 p. 58Lecture-4 : FIR and IIR FilterRealization
Filter Implementation : Coefficient Quantization
Coefficient quantization effect on pole locations :
example : higher-order systems (first-order analysis)
-> tightly spaced poles (e.g. for narrow band filters) imply
high sensitivity of pole locations to coefficient quantization
-> hence preference for low-order systems (parallel/cascade)
!{
}
N
k
kk
ml
lm
kNm
mm
N
NN
N
N
N
aapp
ppp
ppp
zazaza
ppp
zazaza
1
21
22
11
21
2
2
1
1
).()(
,...,,:areroots'`quantized
......1:polynomial'`quantized
,...,,:areroots
......1:polynomial
C ff Q
-
8/3/2019 ALaRI2011_Lecture4
59/64
ALARI/DSP Marc Moonen - Version 2011 p. 59Lecture-4 : FIR and IIR FilterRealization
Coefficient Quantization
PS: Coefficient quantization in lossless lattice realizations,
o = original transfer functiono = original transfer function
+ = transfer function after 8+ = transfer function after 8--bitbit
truncationtruncation of lossless latticeof lossless lattice
filter coefficientsfilter coefficients
-- = transfer function after 8= transfer function after 8--bitbit
truncationtruncation of directof direct--formform
coefficients (bis)coefficients (bis)
In lossless lattice, all coefficients are sines and cosines, hence allIn lossless lattice, all coefficients are sines and cosines, hence all
values betweenvalues between 1 and +1, i.e. `dynamic range and coefficient1 and +1, i.e. `dynamic range and coefficient
quantization error well under control.quantization error well under control.
-
8/3/2019 ALaRI2011_Lecture4
60/64
ALARI/DSP Marc Moonen - Version 2011 p. 60Lecture-4 : FIR and IIR FilterRealization
Filter Implementation : Arithmetic Operations
Finite word-length effects in arithmetic operations:
In linear filters, have to consider additions & multiplications
Addition:
if, two B-bit numbers are added, the result has (B+1) bits.
Multiplication:
if a B1-bit number is multiplied by a B2-bit number, the
result has (B1+B2-1) bits.
For instance, two B-bit numbers yield a (2B-1)-bit product
Typically (especially so in an IIR (feedback) filter), the result of anaddition/multiplication has to be represented again as a B-bit number
(e.g. B=B). Hence have to remove most significant bits and/or least
significant bits
-
8/3/2019 ALaRI2011_Lecture4
61/64
ALARI/DSP Marc Moonen - Version 2011 p. 61Lecture-4 : FIR and IIR FilterRealization
Filter Implementation : Arithmetic Operations
Option-1: Most significant bits (MSBs)If the result is known to be upper bounded such that 1 or more MSBsare always redundant, these MSBs can be dropped without loss ofaccuracy. Dropping MSBs leads to better usage of available word-length, hence better SNR.
This implies we have to monitor potential overflow(=dropping MSBsthat are non-redundant), and possibly introduce additional scalingtoavoid overflow.
Option-2 : Least significant bits (LSBs)
Rounding/truncation/ to B bits introduces quantization noise.
The effect of quantization noise is usually analyzed in a statisticalmanner.
Quantization, however, is a deterministic non-linear effect, which maygive rise to limit cycle oscillations.
-
8/3/2019 ALaRI2011_Lecture4
62/64
ALARI/DSP Marc Moonen - Version 2011 p. 62Lecture-4 : FIR and IIR FilterRealization
Filter Implementation : Arithmetic Operations
zero-input limit cycle oscillations :
Example:
y[k] = -0.625.y[k-1]+u[k]4-bit rounding arithmetic
input u[k]=0, y[0]=3/8
output y[k] = 3/8, -1/4, 1/8, -1/8, 1/8, -1/8, 1/8, -1/8, 1/8,..
=oscillations in the absence of input (u[k]=0)
-
8/3/2019 ALaRI2011_Lecture4
63/64
ALARI/DSP Marc Moonen - Version 2011 p. 63Lecture-4 : FIR and IIR FilterRealization
Filter Implementation : Arithmetic Operations
Example: y[k] = -0.625.y[k-1]+u[k]4-bit truncation (instead of rounding)
input u[k]=0, y[0]=3/8
output y[k] = 3/8, -1/4, 1/8, 0, 0, 0,.. (no limit cycle!)
Example: y[k] = 0.625.y[k-1]+u[k]
4-bit rounding
input u[k]=0, y[0]=3/8
output y[k] = 3/8, 1/4, 1/8, 1/8, 1/8, 1/8,..
Example: y[k] = 0.625.y[k-1]+u[k]
4-bit truncation
input u[k]=0, y[0]=-3/8
output y[k] = -3/8, -1/4, -1/8, -1/8, -1/8, -1/8,..
Conclusion: weird, weird, weird, !
-
8/3/2019 ALaRI2011_Lecture4
64/64
Filter Implementation : Arithmetic Operations
Limit cycle oscillations are clearly unwanted (e.g. may beaudible in speech/audio applications)
Limit cycle oscillations can only appear if the filter has
feedback. Hence FIR filters cannot have limit cycle
oscillations.Mathematical analysis is verydifficult.
Truncation i.o. rounding often helps to avoid limit cycles (e.g.
magnitude truncation, where absolute value of quantizer
output is never larger than absolute value of quantizer input
( passive quantizer)).
Some filter structures can be made limit cycle free, e.g.
coupled realization, lattice filters, .