You are on page 1of 24

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

H() = H(z) z=e j

= z-Transform evaluated on unit circle in the M-D


complex plane| z |= 1
! H (z ) of IIR filter have poles and zeros => stability issue

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:

H1 ( z )

H 2 ( z)

H3(z)

H ( z ) = H1 ( z ).H 2 ( z ).H 3 ( z )
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).

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

b(l , l
1

l1

!
!
!
!
!

l2

) y ( n1 l1 , n2 l 2 ) = a ( r1 , r2 ) x ( n1 r1 , n2 r2 )
r1

r2

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 b( l1 , l2 )

EEE 507 - Lecture 14

Copyright 2004 by Lina J. Karam

IIR Filters
2-D Difference Equation

b(l , l
1

l1

l2

) y ( n1 l1 , n2 l2 ) = a ( r1 , r2 ) x ( n1 r1 , n2 r2 )
r1

Recursive Computability
y ( n1 , n 2 ) =

a (r , r ) x(n
1

r1

r2

r1 , n 2 r2 )

r2

b ( l1 , l 2 ) y ( n1 l1 , n 2 l 2 ) , ( l1 , l 2 ) ( 0 , 0 )
l1
1
4l 2 4 4 442 4 4 4 4 4
3
similar to a convolutio n

Note: b( l1 , l2 ) and a ( r1 , r2 ) were normalized by dividing by b( 0,0)


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.
EEE 507 - Lecture 14

Copyright 2004 by Lina J. Karam

IIR Filters
Recursive Computability
y (n1 , n2 ) = a (r1 , r2 ) x(n1 r1 , n2 r2 ) - b(l1 , l2 ) y (n1 l1 , n2 l2 ), (l1 , l2 ) (0,0)
r1

r2

r2

l1

l2

l2

Input array x

n2

Weight&sum

n1
Input
mask

r1

EEE 507 - Lecture 14

Weight&sum

Output mask

n2
n1

l1

output y

Copyright 2004 by Lina J. Karam

IIR Filters
Recursive Computability
! Examples of recursively-computable output masks
" First-quadrant or causal filter

b(l1 , l2 ) 0 for {0 l1 N1 ,0 l2 N 2 }
n2

N2+1
n1

N2
N1

N1+1

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

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
n2

N2+1

n1

14243
N +N +2
1
3

N1+1 N3

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
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
n2
Output Mask
N2+1

n1

Initial condition
region

N1+1
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.

The first point that


can be calculated is
the origin
x

x
x
x

(0,0)
(0,1)
(0,2)
EEE 507 - Lecture 14

(1,0)
(1,1)

Precedence Graph
(2,0)
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
n2
N-1

n2

N-1

N-1

n1

N-1

n1

Dashed region indicates


the needed storage.
EEE 507 - Lecture 14

Copyright 2004 by Lina J. Karam

IIR filters
Recursive Computability
! Example: Computation Ordering storage/parallelism (continued)
n2

N-1

n2

N-1

N-1

n1

N-1

n1

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.

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.

y(n1 , n2 ) = a(l1 , l2 ) x(n1 l1, n2 l2 )


l1

where
-

l2

b(m , m ) x(n m , n
1

m2 )

m1
m2
( m1 ,m2 ) ( 0, 0)

b(0,0) = 1.

x ( n1 , n2 ) = ( n1 , n2 ) y ( n1 , n2 ) = h ( n1 , n2 )

h(n1 , n2 ) = a (n1 , n2 )

b( m , m ) h( n m , n
1

m2 )

m1
m2
( m1 , m2 ) ( 0 , 0 )

H z ( z1 , z 2 ) = a(l1 , l2 ) z1 z 2
1

l1

l2

A (z , z )
H z ( z1 , z 2 ) = z 1 2 , where
Bz ( z1 , z 2 )

b( m , m ) z
1

m1

z2

m2

H z ( z1 , z 2 )

m1
m2
( m1 , m2 ) ( 0 , 0 )

Az ( z1 , z2 ) = a (l1 , l2 ) z1 z 2
1

l1

l2

Bz ( z1 , z2 ) = b(m1 , m2 ) z1

m1

z2

m2

; b(0,0) = 1

m1 m2

EEE 507 - Lecture 14

Copyright 2004 by Lina J. Karam

Implementation of IIR Filters


Direct Form (recursive) Implementation
!

H z ( z1 , z 2 ) can be implemented as the cascade of two filters:


Direct Form I

x ( n1 , n2 )

FIR

Az ( z1 , z2 )

Purely IIR

1
Bz ( z1 , z 2 )

y ( n1 , n2 )

" Assume output mask is swept column-by-column:


If N2 output points desired per column
- For filter Az ( z1 , z2 ) with an L1 L2 input mask, we need to store
( L1 1) N 2 + L2 1 input samples.
- For filter Bz ( z1 , z2 ) with an M 1 M 2 output mask, we need to store
( M 1 1) N 2 + M 2 1 computed output samples.

Alternative Implementation (Direct Form II)


( n1 , n 2 )
x ( n1 , n 2 )
1
Bz ( z1 , z 2 )

EEE 507 - Lecture 14

y ( n1 , n 2 )

Az ( z1 , z 2 )
Copyright 2004 by Lina J. Karam

Implementation of IIR Filters


Direct Form (recursive) Implementation
! Aternative Implementation: Direct Form II
( n1 , n 2 )
x ( n1 , n 2 )
1
Bz ( z1 , z 2 )

y ( n1 , n 2 )

Az ( z1 , z 2 )

" Reduces storage required.


" Storage shared between the feedback and feedforward stages: only the
samples of ( n1 , n 2 ) 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
2
some IIR filters
" Example: Bandpass formed by cascading
1
a lowpass and a highpass filter
EEE 507 - Lecture 14

Copyright 2004 by Lina J. Karam

Implementation of IIR Filters


Iterative implementation for 2-D IIR filters
! Recursive versus Iterative Implementation
Recursive Implementation

Iterative Implementation

Efficient
Requires recursive computability

Not so efficient
Recursive computability not required (does
not have to be casual)
Can use boundary condition
All input samples need to be available and
stored (such as in image processing)

Requires initial conditions


Does not require storing all input
sample

! 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).

EEE 507 - Lecture 14

Copyright 2004 by Lina J. Karam

Implementation of IIR Filters


Iterative implementation for 2-D IIR filters
! Basic Iterative implementation
H z ( z1 , z2 ) =

Az ( z1 , z 2 )
Az ( z1 , z2 )
=
Bz ( z1 , z 2 ) 1 C z ( z1 , z2 )

where C z ( z1 , z 2 ) = 1 Bz ( z1 , z 2 )
1424
3
deno min ator

Y z ( z1 , z 2 ) = H z ( z1 , z 2 ). X z ( z1 , z 2 )

Y z ( z1 , z 2 ) = Az ( z1 , z 2 ). X z ( z1 , z 2 ) + C z ( z1 , z 2 ).Y z ( z1 , z 2 )
y ( n1 , n2 ) = a ( n1 , n2 ) x ( n1 , n2 ) + c ( n1 , n2 ) y ( n1 , n2 )

EEE 507 - Lecture 14

(*)

Copyright 2004 by Lina J. Karam

Implementation of IIR Filters

Iterative implementation for 2-D IIR filters


! Basic Iterative implementation

y (n1 , n2 ) = a (n1 , n2 ) x(n1 , n2 ) + c(n1 , n2 ) y (n1 , n2 )

(*)

- Approach:
1. Guess y ( n1 , n 2 )
2. Substitute in the RHS of () to get a better estimate
3. Repeat Step 2 until satisfied
- Note: a ( n1 , n 2 ) and

c ( n1 , n 2 ) 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)

yi ( n1 , n2 ) = a (n1 , n2 ) x ( n1 , n2 ) + c( n1 , n2 ) yi 1 (n1 , n2 )

Yi (1 , 2 ) = Az (1 , 2 ). X z (1 , 2 ) + C z (1 , 2 ).Yi 1 (1 , 2 )
EEE 507 - Lecture 14

Copyright 2004 by Lina J. Karam

Implementation of IIR Filters


Iterative implementation for 2-D IIR filters
! Basic Iterative implementation

y i ( n1 , n2 ) = a ( n1 , n2 ) x ( n1 , n2 ) + c( n1 , n2 ) y i 1 ( n1 , n2 )
In frequency domain, this becomes:

Yi (1 , 2 ) = A(1 , 2 ). X (1 , 2 ) + C (1 , 2 ).Yi 1 (1 , 2 )

Convergence Proof:
- Let the initial guess be Y-1(1, 2)= 0.

Y0 (1 , 2 ) = A(1 , 2 ). X (1 , 2 )
Y1 (1 , 2 ) = A(1 , 2 ). X (1 , 2 ) + C (1 , 2 ). A(1 , 2 ). X (1 , 2 )

I
M
YI (1,2 ) = A(1,2 ).X (1,2 )Ci (1,2 )
i =0

1 C I +1 (1 , 2 )
= A(1 , 2 ). X (1 , 2 )
1 C (1 , 2 )
- Convergence condition: C (1 , 2 ) < 1
A(1 , 2 )
lim I YI (1 , 2 ) =
X (1 , 2 ) = H (1 , 2 ) X (1 , 2 ) = Y (1 , 2 )
1 C (1 , 2 )
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 C (1 , 2 ) < 1 is too restrictive
since stability only requires C (1 , 2 ) 1
- Not all 2-D stable IIR filters can be implemented with this basic method

! Solution: Multiply denominator and numerator by B (1 , 2 ) where


=constant parameter
=> Generalized Iterative Implementation
*

EEE 507 - Lecture 14

Copyright 2004 by Lina J. Karam

Implementation of IIR Filters


Iterative implementation for 2-D IIR filters
! Generalized Iterative implementation

A(1 , 2 ) B (1 , 2 ) A(1 , 2 )
=
H (1 , 2 ) =
2
B (1 , 2 )
B (1 , 2 )
- Set

C (1 , 2 ) = 1 B(1 , 2 )
142
4 43
4
2

- Choose paramter

0< <

deno min ator

in the range

2
max B ( 1 , 2 )

( 1 , 2 )

C (1 , 2 ) < 1, for all B (1 , 2 )

EEE 507 - Lecture 14

Copyright 2004 by Lina J. Karam

Implementation of IIR Filters


Iterative implementation for 2-D IIR filters
! Generalized Iterative implementation

A(1 , 2 ) B (1 , 2 ) A(1 , 2 ) B (1 , 2 ) A(1 , 2 ) Y (1 , 2 )


H (1 , 2 ) =
=
=
=
2

B(1 , 2 )
1

C
((
,
)
X (1 , 2 )
B (1 , 2 )
1
2

- Iterative computation:
Initial Guess: Y-1(1, 2) = 0.

Yi (1 , 2 ) = B (1 , 2 ). A(1 , 2 ). X (1 , 2 ) + C (1 , 2 )Yi 1 (1 , 2 )

1 C I +1 (1 , 2 )
YI (1 , 2 ) = B (1 , 2 ) A(1 , 2 ) X (1 , 2 ) +
, at iteration " I"
1 C (1 , 2 )
*

lim I YI (1 , 2 ) = Y (1 , 2 )

- Note: True phase of Y (1 , 2 ) obtained directly: Y0 ( 1 , 2 ) = Y (1

EEE 507 - Lecture 14

Copyright 2004 by Lina J. Karam

Implementation of IIR Filters


Iterative implementation for 2-D IIR filters
! Generalized Iterative implementation

1 C I +1 (1 , 2 )
, at iteration " I"
YI (1 , 2 ) = B (1 , 2 ) A(1 , 2 ) X (1 , 2 ) +
1 C (1 , 2 )
*

- Error:

E ( 1 , 2 )

Y ( 1 , 2 )
I +1
1 = C ( 1 , 2 )
YI ( 1 , 2 )

- Stop iteration when

max E (1 , 2 ) <

(1, 2 )

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 by (1 , 2 )

EEE 507 - Lecture 14

Copyright 2004 by Lina J. Karam

You might also like