Documente Academic
Documente Profesional
Documente Cultură
Processing
-Filter Realization
By
Dr. K. Udhayakumar
Introduction
In earlier chapters we studied the theory of discrete
systems in both the time and frequency domains.
We will now use this theory for the processing of
digital signals.
To process signals, we have to design and implement
systems called filters.
The filter design issue is influenced by such factors as
The type of the filter: IIR or FIR
The form of its implementation: structures
Different filter structures dictate different design strategies.
Introduction
IIR filters are characterized by infinite-duration
impulse response. Some of these impulse
responses can be modeled by
Rational system functions
Difference equations
ARMA or recursive filters
We will treat FIR filter separately from IIR
filters for both design and implementation
purposes.
Introduction
Since our filters are LTI systems, we need the
following three elements to describe digital filter
structures.
Adder
Multiplier (Gain)
Delay element (shift or memory)
x1(n)
x2(n)
x1(n)+x2(n)
x(n) ax(n)
a
x(n) x(n-1)
1/z
IIR Filter Structures
The system function of an IIR filter is given by
1 ;
1 ) (
) (
) (
0
1
1
1
1 0
0
0
=
+ + +
+ + +
= = =
=
a
z a z a
z b z b b
z a
z b
z A
z B
z H
N
N
M
M
N
n
n
n
M
n
n
n
N M if only
N M
k
k
k
K
k
k k
k k
N M if only
N M
k
k
k
N
N
N
M
N
N
M
M
z C
z A z A
z B B
z C
z a z a
z b z b b
z a z a
z b z b b
z A
z B
z H
>
>
+
+ +
+
=
+
+ + +
+ + +
=
+ + +
+ + +
= =
0 1
2
2 ,
1
1 ,
1
1 , 0 ,
0
1
1
1
1 0
1
1
1
1 0
1
1
1 ) (
) (
) (
K=N/2, and
B,A are real
numbers
The second-order section
< = =
=
+ +
+
= =
+
N M z Y z Y z X z H z Y with
K k
z A z A
z B B
z Y
z Y
z H
k k k
k k
k k
k
k
k
), ( ) ( ), ( ) ( ) (
, , 2 , 1 ,
1 ) (
) (
) (
2
2 ,
1
1 ,
1
1 , 0 ,
1
= + + + =
1
0
1
1
1
1 0
) (
M
n
n
n
M
M
z b z b z b b z H
Hence the impulse response h(n) is
s s
=
else
M n bn
n h
0
1 0
) (
And the difference equation representation is
) 1 ( ) 1 ( ) ( ) (
1 1 0
+ + + + =
M n x b n x b n x b n y
M
\
|
+ + + =
+ + + =
=
+ + + + + + =
+ + + + + + =
)] 2 ( ) 1 ( [ )] 1 ( ) ( [
) 1 ( ) 2 ( ) 1 ( ) ( ) (
1 0
0 1 1 0
M n x n x b M n x n x b
M n x b M n x b n x b n x b n y
Frequency Sampling Form
In this form we use the fact that the system function H(z) of an
FIR filter can be reconstructed from it samples on the unit
circle
) 1 , , 0 ( ) (
) 1 , , 0 (
1
) ( 1
) (
1
0
1
=
=
|
|
.
|
\
|
=
let p1=W
M
-k
=exp(-j*2*pi*k/M)
=cos(2*pi*k/M)+jsin(2*pi*k/M)
H
k
=magH
k
*exp(j*phaH
k
)
=magH
k
*(cos(phaH
k
)+jsin(phaH
k
))
Then:
2 1
1
1
*
1
*
1
1
) / 2 cos( 2 1
) / 2 cos( ) cos(
* | | 2
1
1
) (
+
Z Z
=
=
z M k z
M k H z H
H
z p
H
z p
H
z H
k k
k
k k
k
t
t
Figure 6.16
MATLAB functions and Examples
Notify the structure type
[C,B,A]=dir2fs(h) of textbook
A practical problem: unstable, avoid this
problem by sampling H(z) on a circle |z|=r.
Ex6.6 find frequency sample form
Ex6.7 In this example the frequency sample
form has less computational complexity than
direct form.
Lattice Filter Structure
The lattice filter is extensively used in digital speech
processing and in implementation of adaptive filter.
It is a preferred form of realization over other FIR or
IIR filter structures because in speech analysis and in
speech synthesis the small number of coefficients
allows a large number of formants to be modeled in
real-time.
All-zeros lattice is the FIR filter representation of the lattice
filter.
The lattice ladder is the IIR filter representation.
All-zero Lattice Filters
An FIR filter of length M (or order M-1) has a lattice
structure with M-1 stages.
x(n)
f0(n)
g0(n)
K0
1/z 1/z 1/z
g1(n)
gM-1(n)
g2(n) gM(n)
f1(n) f2(n) fM-1(n) fM(n)
y(n)
K1
K1
K2
K2
KM
KM
1 , , 2 , 1 ), ( ) ( ) (
1 , , 2 , 1 ), ( ) ( ) (
1 1
1 1
= + =
= + =
M m n g n f K n g
M m n g K n f n f
m m m m
m m m m
=
|
|
.
|
\
|
+ = =
1
0
1
1
0
0
1 ) (
M
m
M
m
m
m
m
m
z
b
b
b z b z H
If the FIR filter is given by the direct form
And if we denote the polynomial
1 , , 1 , ) ( ; ) ( 1 ) (
0
1
1
1
1 1
= =
|
.
|
\
|
+ =
M m
b
b
m z m z A
m
M
M
m
m
M M
o o
Then the lattice filter coefficients {Km} can be obtained by
the following recursive algorithm
1 , , 2 ); (
1 , , 1 ;
1
) ( ) (
) (
1 , , 1 ); 1 ( ) (
) 1 (
2
1
1 1
0 0
= =
=
=
= =
=
=
M m m K
M m
K
z J K z A
z A
M m z A z z J
M K
b K
m m
m
m m m
m
m
m
m
M M
o
o
Note that the above algorithm will fail if |Km|=1 for any m. Clearly, this
condition is satisfied by the linear-phase FIR filter.
Therefore, linear-phase FIR filter cannot be implemented using lattice
structure.
Matlab Implementation
Functions:
[K] = dir2latc(b)
[y] = latcfilt(K,x)
[b] = latc2dir(K)
Example 6.8
All-pole Lattice Filter
A lattice structure for an IIR filter is restricted to an all-pole
system unction.
It can be developed from an FIR lattice structure.
This IIR filter of order N has a lattice structure with N stages as
shown in Fig.6.20.
Each stage of the filter has an input and output that are related
by the order-recursive equations.
) (
1
) ( 1
1
) (
1
z A
z m a
z H
N
N
m
m
N
=
+
=
Matlab Implementation
Function [K] = dir2latc(a)
Care must be taken to ignore the K0 coefficient
in the K array.
Function [a] = latc2dir(K)
K0=1
Lattice ladder Filters
A general IIR filter containing both poles and zeros can be
realized as a lattice-type structure by using an all-pole lattice as
the basic building block.
Consider an IIR filter with system function
Where, without loss of generality, we assume that N>=M
) (
) (
) ( 1
) (
) (
0
0
z A
z B
z k a
z k b
z H
N
M
N
k
k
N
M
k
k
M
=
+
=
=
=
M
m
m m
n g C n y
0
) ( ) (
{Cm} are called the ladder coefficients that determine the
zeros of the system function H(z).
0 , , 1 , ); (
, , 2 , 0 ); ( ) ( ) (
) ( ) (
1
1
0
= + =
= + =
=
+ =
=
M M m m i C b C
M m z J C z B z B
z J C n B
i
M
m i
i m m
m m m m
M
m
m m M
o
Matlab Implementation
Function [K,C] = dir2ladr(b,a)
To use this function, N>=M. If M>N, then the numerator
AN(z) should be divided into the denominator BM(z) using
the deconv function to obtain a proper rational part and a
polynomial part. The proper rational part can be
implemented using the lattice-ladder structure, while the
polynomial part is implemented using the direct structure.
Function [b,a] ladr2dir(K,C)
Function [y] = ladrfilt(K,C,x)
Readings and exercises
Textbook : pp182~217
Chinese ref. Book: pp.128~137, 231~234
Exercises :
1. 6.2, 6.3 both except (e)
2. 6.2e, 6.3e, 6.8, 6.10