Upload
sitaram1
View
212
Download
0
Embed Size (px)
DESCRIPTION
eee507_IIRFiltersImplement
Citation preview
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
IIR Filters Infinite-length impulse response => cannot use convolution or DFT
to realize filter IIR filter generally implemented using difference equations and
recursive implementation General system response defined using z- transform
! Frequency response
= z-Transform evaluated on unit circle in the M-Dcomplex plane
! of IIR filter have poles and zeros => stability issue
jezzHH == )()(
1|| =z)(zH
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
IIR Filters
Why interest in z-Transform?! DFT computable! z-Transform
" Poles and zeros => can describe filter characteristics" Implementation, how to build a filter
Example:
How to break H(z) into components has a lot to do with hardware implementation (for example, get chips implementing a 2nd order digital filter on and hook these together).
)(1 zH )(2 zH )(3 zH
)().().()( 321 zHzHzHzH =
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
IIR Filters Issues:
! Polynomials do not factor in M-D case! Difference equations harder to deal with (direction of recursion, ordering
relation) than 1-D! Stability analysis much more complicated than 1-D
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
IIR Filters 2-D Difference Equation
! Difference equation used to implement IIR filters! Sums have finite limits ! Size of b is related to the filter order ! The system is LSI if it is at initial rest! Order of difference equation = size of region of support of
=1 21 2
),(),(),(),( 221121221121r rl l
rnrnxrralnlnyllb
),( 21 llb
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
IIR Filters 2-D Difference Equation
Recursive Computability
Note: and were normalized by dividing by To use this as an algorithm, the output samples on the right need to be
computed before the one on the left! We can calculate output given input on a sample-by-sample basis! We have to find out which step to execute first in order to be able to compute all
needed output samples recursively If an ordering exists so that all needed output samples on the right side, are
available when needed, then the system is recursively computable.
)0,0(),(,),(),(
),(),(),(
21
nconvolutio a similar to
221121
22112121
1 2
1 2
=
lllnlnyllb
rnrnxrranny
l l
r r
44444 344444 21
),( 21 llb ),( 21 rra )0,0(b
=1 21 2
),(),(),(),( 221121221121r rl l
rnrnxrralnlnyllb
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
IIR Filters
r2
Weight&sumn2
n1r1
Input mask
Weight&sum+ n2
n1
l2
l1
Output maskInput array x
output y
-+
)0,0(),( ,),(),(-),(),(),( 21221121221121211 21 2
= lllnlnyllbrnrnxrrannyl lr r
Recursive Computability
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
IIR Filters Recursive Computability
! Examples of recursively-computable output masks" First-quadrant or causal filter
Boundary conditions for output y needed in L-shaped region and are indicated by open circles
Output mask can be swept upward column by column, or left to right row by row, or over any family of parallel lines with negative slope
}0,0{for 0),( 221121 NlNlllb
N1+1
N2+1
n2
n1
N1
N2
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
IIR Filters
Recursive Computability! Examples of recursively-computable output masks
" Non-symmetric half-plane (NSHP) filter
Shape of boundary condition band depends on filter order NSHP is a generalization of quadrant filter NSHP filters can be further generalized by either a reflection or a
rotation of the output mask or by a combination of both operations
N1+1
N2+1
n2
n1
N3
{2
N43421
231++ NN
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
IIR Filters Recursive Computability
! Not all masks are recursively computable! Examples of non-recursively computable output masks
Position of hole does not lie on a corner
! In general, there are only two types of recursively computable output masks" Quadrant-plane (4)" Non-symmetric half-plane (NSHP) (8)
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
IIR Filters Recursive Computability
! Boundary conditions" For a recursive system, how do you choose the boundary conditions?" If the system is LSI, the initial conditions must be zero and they must lie
outside the support of the output y(n1,n2)
! Ordering the computations" Output samples can be computed in any one several possible orderings =>
computation only partially ordered" Partial ordering represented by precedence graph
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
IIR Filters Recursive Computability
! Example: Computation Ordering and Precedence Graph
N1+1
N2+1
n2
n1Initial condition region
Output Mask
The first point that can be calculated is the origin
xx
The next point to be computed is (0,1) or (1,0), or we can calculate both of them in parallel if the hardware permits.
xx
x
(0,0)
(1,0)(0,1)
(2,0)(1,1)(0,2)
Precedence Graph
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
IIR Filters Recursive Computability
! Not all the possible computation orderings are equivalent" Amount of storage" Degree of parallelism
! Example: " 3x3 output mask" Output evaluated on NxN square region
N-1
n2
n1
N-1
N-1
n2
n1
N-1
Dashed region indicatesthe needed storage.
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
IIR filters Recursive Computability
! Example: Computation Ordering storage/parallelism (continued)
- Dashed region indicates samples to be buffered.- If output mask is of size L1xL2, column-by-column implementation requires the
storage of (L1-1)N+(L2-1) samples. - Output samples along any diagonal can be computed independently => all output
samples along a diagonal can be computed simultaneously.- Diagonal versus column (or row) implementation
" Diagonal implementation is maximally parallel if parallel hardware available." Diagonal more efficient computationally due to possible parallel
implementation but more storage required.Note: each diagonal has a different length => must allow storage for the longest one.
N-1
n2
n1
N-1
N-1
n2
n1
N-1
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
Implementation of IIR Filters Direct Form (recursive) Implementation
! Rearrange difference equation to express output sample in terms of input samples and previously computed output samples
! Requires filter to be recursively computable.
where .
-
=
),(
)0,0(
22112122112121
211 21 2
),(),(),(),(),(mm
m ml lmnmnxmmblnlnxllanny
1)0,0( =b
),(),(),(),( 21212121 nnhnnynnnnx ==
=
),(
)0,0(
2211212121
211 2
),(),(),(),(mm
m mmnmnhmmbnnannh
=
),(
)0,0(
2121211
21
12121
211 2
21
1 2
),(),(),(),(mm
m mz
mm
l lz zzHzzmmbzzllazzH
,),(),(),(
21
2121 zzB
zzAzzHz
zz =
1)0,0( ;),(),(
),(),(
1 2
21
1 2
212121
12
112121
==
=
bzzmmbzzB
zzllazzA
m m
mmz
l lzwhere
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
Implementation of IIR Filters Direct Form (recursive) Implementation
! can be implemented as the cascade of two filters: Direct Form I
" Assume output mask is swept column-by-column: If N2 output points desired per column
- For filter with an input mask, we need to store input samples.
- For filter with an output mask, we need to store computed output samples.
- Alternative Implementation (Direct Form II)
),( 21 zzHz
),( 21 zzAz),( 21 nnx ),( 21 nny
),(1
21 zzBz
21 LL 1)1( 221 + LNL
),( 21 zzBz
),( 21 zzAz
21 MM
),( 21 zzAz),( 21 nnx ),( 21 nn ),( 21 nny
),(1
21 zzBz
FIR Purely IIR
1)1( 221 + MNM
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
Implementation of IIR Filters
Direct Form (recursive) Implementation
! Aternative Implementation: Direct Form II
" Reduces storage required." Storage shared between the feedback and feedforward stages: only the
samples of need to be stored.! Cascade and parallel implementations can be used to design specific
IIR filters" Contrary to 1-D case, a general 2-D IIR filter cannot be decomposed into a
cascade of simpler filters" Cascading or interconnecting filters in parallel can be used to synthesize
some IIR filters" Example: Bandpass formed by cascading
a lowpass and a highpass filter
),( 21 nn
),( 21 zzAz),( 21 nnx ),( 21 nn ),( 21 nny
),(1
21 zzBz
2
1
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
Iterative implementation for 2-D IIR filters! Recursive versus Iterative Implementation
! Iterative method is an attempt to design and implement non-recursively computable IIR filters
! Iteratively generates better estimates of output y(n1,n2) given the desired transfer function Hz(z1,z2).
Recursive Implementation
Efficient Requires recursive computability
Requires initial conditionsDoes not require storing all input sample
Iterative Implementation
Not so efficient Recursive computability not required (does
not have to be casual)Can use boundary conditionAll input samples need to be available and stored (such as in image processing)
Implementation of IIR Filters
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
Iterative implementation for 2-D IIR filters! Basic Iterative implementation
),(1),(
),(),(),(
21
21
21
2121 zzC
zzAzzBzzAzzH
z
z
z
zz
==
43421atordeno
zz zzBzzCmin
2121 ),(1),( where =
),().,(),( 212121 zzXzzHzzY zzz =
),().,(),().,(),( 2121212121 zzYzzCzzXzzAzzY zzzzz +=
(*)),(),(),(),(),( 2121212121 nnynncnnxnnanny +=
Implementation of IIR Filters
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
Implementation of IIR Filters Iterative implementation for 2-D IIR filters
! Basic Iterative implementation
- Approach:1. Guess2. Substitute in the RHS of to get a better estimate3. Repeat Step 2 until satisfied
- Note: and are FIR filters- Issue: will estimates converge to true output?
Answer: Yes, but infinite number of iterations needed => after some finite number of iterations, we get a very
good estimate (small error)
),( 21 nny
),( 21 nna ),( 21 nnc
)(
),(),(),(),(),( 21121212121 nnynncnnxnnanny ii +=),().,(),().,(),( 21121212121 += izzzi YCXAY
(*)),(),(),(),(),( 2121212121 nnynncnnxnnanny +=
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
Implementation of IIR Filters Iterative implementation for 2-D IIR filters
! Basic Iterative implementation
In frequency domain, this becomes:
Convergence Proof:- Let the initial guess be Y-1(1, 2)= 0.
- Convergence condition:
),().,(),( 2121210 XAY =
M
),().,().,(),().,(),( 2121212121211 XACXAY +=
=
=
I
i
iI CXAY
021212121 ),(),().,(),(
1),( 21
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
Implementation of IIR Filters Iterative implementation for 2-D IIR filters
! Basic Iterative implementation" Disadvantage:
- Convergence condition is too restrictive since stability only requires
- Not all 2-D stable IIR filters can be implemented with this basic method
! Solution: Multiply denominator and numerator by where=constant parameter
=> Generalized Iterative Implementation
1),( 21 C
),( 21
* B
1),( 21
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
Iterative implementation for 2-D IIR filters! Generalized Iterative implementation
- Set
- Choose paramter in the range
221
2121
21
2121
),(),(),(
),(),(),(
BAB
BAH
==
4434421atordeno
BCmin
22121 ),(1),( =
Implementation of IIR Filters
221),(),(max
20
21
B
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
Implementation of IIR Filters Iterative implementation for 2-D IIR filters
! Generalized Iterative implementation
- Iterative computation:Initial Guess: Y-1(1, 2) = 0.
- Note: True phase of obtained directly:
),(),(lim 2121 YYII =
),(),(),().,().,(),( 2112121212121 += ii YCXABY
I""iteration at ,),(1),(1),(),(),(),(
21
211
212121*
21
CCXABY
I
I
+=+
(),( ),( 121021 YYY =
),(),(
),((1),(),(
),(),(),(
),(),(),(
21
21
21
21212
21
2121
21
2121
XY
CAB
BAB
BAH =
===
EEE 507 - Lecture 14 Copyright 2004 by Lina J. Karam
Iterative implementation for 2-D IIR filters! Generalized Iterative implementation
- Error:
- Stop iteration when
where is the desired tolerance (usually, a small positive constant), and is a specified band of frequencies.
- Note: Error distribution can be controlled on desired bands by using a weighting function => replace
121
21
2121 ),(1),(
),(),( += II
CYYE