Sie sind auf Seite 1von 26

2006 Copyright 2006 Andreas Spanias 13-16-1

Design of FIR Digital Filters;


LINEAR PHASE
Lecture 13-15
Andreas Spanias
spanias@asu.edu
2006 Copyright 2006 Andreas Spanias 13-16-2
FIR Digital Filters
Advantages:
Linear Phase Design
Quite Efficient for designing notch filters
Always Stable
Disadvantages:
Requires High Order for Narrowband Design
Applications:
Speech Processing, Telecommunications
Data Processing, Noise Suppression, Radar
Adaptive Signal Processing, Noise Cancellation, Echo
Cancellation, Multipath channels
2006 Copyright 2006 Andreas Spanias 13-16-3
FIR Digital Filters
_
=
=
L
i
i
i n x b n y
0
) ( ) (
( ) n y
( ) n x
T T
0
b
L
b
...
.
.
.
.
.
+
+
+
+
_
1
b
.
L
L
z z X b z z X b z X b z Y

+ + + = ) ( ... ) ( ) ( ) (
1
1 0
L
L
z b z b b
z X
z Y
z H

+ + + = = ...
) (
) (
) (
1
1 0
2006 Copyright 2006 Andreas Spanias 13-16-4
FIR Filter Frequency Response
O O O
+ + + =
jL
L
j j
e b e b b e H ... ) (
1 0
s
f
f
t 2 = O
o
o
foldover
2006 Copyright 2006 Andreas Spanias 13-16-5
FIR Filter Design
1. LINEAR PHASE DESIGN
2. FOURIER SERIES DESIGN
3. ZERO PLACEMENT
4. FREQUENCY SAMPLING
5. LEAST SQUARES
6. IMPLEMENTATIONS
2006 Copyright 2006 Andreas Spanias 13-16-6
LINEAR PHASE DESIGN
Linear Phase (constant time delay) FIR filter design is important
in pulse transmission applications where pulse dispersion must
be avoided. The frequency response function of the FIR filter is
written as:
O O O O
+ + + + =
jL
L
j j j
e b e b e b b e H ... ) (
2
2 1 0
where
)) ( arg( ) ( , ) ( ) (
O O
= O u = O
j j
e H e H M
) (
) ( ) (
O u O
O =
j j
e M e H
2006 Copyright 2006 Andreas Spanias 13-16-7
GROUP DELAY
The time delay or group delay of a filter is defined as
O
O u
=
d
d ) (
t
therefore if is a linear function of then t is a
constant.
t is given in terms of samples
( ) O u
O
2006 Copyright 2006 Andreas Spanias 13-16-8
LINEAR PHASE AND IMPULSE RESPONSE
SYMMETRIES
It can be shown that linear phase is achieved if
) ( ) ( n L h n h =
where h(n) is the impulse response of the filter. For L = odd
_

=

+ =
2
1
0
) (
) )( ( ) (
L
n
n L n
z z n h z H
_

=
O

O
|
|
.
|

\
|
|
.
|

\
|
O =
2
1
0
2
2
cos ) ( 2 ) (
L
n
L
j
j
n
L
n h e e H
2006 Copyright 2006 Andreas Spanias 13-16-9
LINEAR PHASE DESIGN
if we define the pseudomagnitude
_

=
O
|
|
.
|

\
|
|
.
|

\
|
O =
2
1
0
1
2
cos ) ( 2 ) (
L
n
j
n
L
n h e H
Then

< H +
O

>
O

= O u
O
O
0 ) ( ,
2
0 ) ( ,
2
) (
1
1
j
j
e H
L
e H
L
hence the phase response is piecewise linear.
2006 Copyright 2006 Andreas Spanias 13-16-10
SYMMETRIC AND ANTI-SYMMETRIC
LINEAR PHASE FILTERS
Two Anti-symmetries for L=even or L=odd for
) ( ) ( n L h n h =
) ( ) ( n L h n h =
Two Symmetries for L=even or L=odd for
2006 Copyright 2006 Andreas Spanias 13-16-11
EXAMPLES OF SYMMETRIES
( ) n h
4 = L
0
( ) n h
0
( ) n h
0
( ) n h
0
4 = L
3 = L
3 = L
2006 Copyright 2006 Andreas Spanias 13-16-12
EXAMPLES OF PHASE AND SYMMETRY IN h(n)
Normalized frequency (Nyquist == 1)
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-200
-150
-100
-50
0
50
P
h
a
s
e

(
d
e
g
r
e
e
s
)
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-200
-100
0
100
Normalized frequency (Nyquist == 1)
P
h
a
s
e
(
d
e
g
r
e
e
s
)
( ) n h
0
( ) n h
0
4 = L
4 = L
2006 Copyright 2006 Andreas Spanias 13-16-13
Note that for
) ( ) ( n L h n h =
then
) ( ) (
1
= z H z z H
L
Hence for L=odd and z = -1 then
) 1 ( ) 1 ( ) 1 ( = H H
L
Thus the filter must have a zero at and is therefore not
adequate for high-pass filtering.
t = O
HPF USING CERTAIN LINEAR PHASE FILTERS
2006 Copyright 2006 Andreas Spanias 13-16-14
Note that for
) ( ) ( n L h n h =
then
) ( ) (
1
= z H z z H
L
Hence any L and z = 1 then
) 1 ( ) 1 ( H H =
Thus the filter must have a zero at and is therefore not
adequate for low-pass filtering.
0 = O
LPF USING CERTAIN LINEAR PHASE FILTERS
2006 Copyright 2006 Andreas Spanias 13-16-15
Design of FIR Digital Filters
Lecture 14 - FIR DESIGN USING
THE FOURIER SERIES
Andreas Spanias
spanias@asu.edu
2006 Copyright 2006 Andreas Spanias 13-16-16
Design Using the Fourier Series
In filter design, there is an ideal transfer function H
d
(z) that is
approximated by H(z). For example for a low-pass filter, an
ideal frequency response is given below:
We like to minimize the mean square error, i.e.,
)
H
H
O O
O
H
e= d e H e H
j j
d
2
) ( ) (
2
1
( ) z H
d
c
O O
c
O
2006 Copyright 2006 Andreas Spanias 13-16-17
Design Using the Fourier Series (Cont.)
Recalling that in general
_
=
O O
=
2
1
) ( ) (
n
n i
ji j
e i h e H
then
)
_
H
H
=
O O
O
H
e= d e i h e H
n
n i
ji j
d
2
2
1
) ( ) (
2
1
Minimization of the integral above leads to an h(n) sequence that is
precisely equal to the sequence of Fourier series coefficients
characterizing H
d
(z). The resultant impulse response sequence is a
sampled truncated sinc function.
2006 Copyright 2006 Andreas Spanias 13-16-18
Fourier Series Design Example
For the ideal low pass filter the impulse response sequence is an
infinite length sampled sinc function. Lets say the sampling
frequency is 8KHz and we wish to have a cutoff frequency at
2KHz. This results in
2 8000
2000
2 2
H
= = H = O t
s
c
c
f
f
That is
( ) z H
d
2
n

2
n
O
2006 Copyright 2006 Andreas Spanias 13-16-19
Fourier Series Design Example (Cont.)
The ideal impulse response h
d
(n) is given by
,... 2 , 1 , 0 ,
2
sinc
2
1
) ( =
|
.
|

\
|
= n
n
n h
d
t
For an FIR filter of 11 coefficients
)
`

= ,... 0 , 0 ,
5
1
, 0 ,
3
1
, 0 ,
1
,
2
1
,
1
, 0 ,
3
1
, 0 ,
5
1
, 0 , 0 ... ) (
t t t t t t
n h
This impulse response is not causal, however a shift operator of 5
delays (z
-5
) will convert it into a causal one.
2006 Copyright 2006 Andreas Spanias 13-16-20
REALIZATION
. .
+
t 5 / 1 t 3 / 1
t / 1
2 1/
_
+ +
.
.
.
.
1
z
1
z
1
z
1
z
1
z
1
z
1
z
1
z
1
z
1
z
( ) n y
( ) n x
2006 Copyright 2006 Andreas Spanias 13-16-21
Fourier Series Design Example (Cont.)
t t t t t t 5
1
,
3
1
,
1
,
2
1
,
1
,
3
1
,
5
1
10 8 6 5 4 2 0
= = = = = = = b b b b b b b
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-600
-400
-200
0
Normalized frequency (Nyquist == 1)
P
h
a
s
e

(
d
e
g
r
e
e
s
)
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-80
-60
-40
-20
0
20
Normalized frequency (Nyquist == 1)
M
a
g
n
i
t
u
d
e

R
e
s
p
o
n
s
e

(
d
B
)
2006 Copyright 2006 Andreas Spanias 13-16-22
Fourier Series Design Example L=32
16 , 15 ,.... 0 ,...., 15 , 16 ,
2
) 16 (
sinc
2
1
=
|
.
|

\
|

= n
n
b
n
t
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-2000
-1500
-1000
-500
0
Normalized frequency (Nyquist == 1)
P
h
a
s
e

(
d
e
g
r
e
e
s
)
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-80
-60
-40
-20
0
20
Normalized frequency (Nyquist == 1)
M
a
g
n
i
t
u
d
e

R
e
s
p
o
n
s
e

(
d
B
)
2006 Copyright 2006 Andreas Spanias 13-16-23
Fourier Series Design Example L=64
32 , 31 ,.... 0 ,...., 31 , 32 ,
2
) 32 (
sinc
2
1
=
|
.
|

\
|

= n
n
b
n
t
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-3000
-2000
-1000
0
Normalized frequency (Nyquist == 1)
P
h
a
s
e

(
d
e
g
r
e
e
s
)
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-100
-50
0
50
Normalized frequency (Nyquist == 1)
M
a
g
n
i
t
u
d
e

R
e
s
p
o
n
s
e

(
d
B
)
2006 Copyright 2006 Andreas Spanias 13-16-24
Truncating with Hamming Window L=64
Hamming(L) *
2
) 32 (
sinc
2
1
|
.
|

\
|

=
t n
b
n
0 0. 1 0. 2 0. 3 0. 4 0. 5 0. 6 0. 7 0. 8 0. 9 1
-4000
-3000
-2000
-1000
0
Normal iz ed frequenc y (Ny quis t = = 1)
P
h
a
s
e

(
d
e
g
r
e
e
s
)
0 0. 1 0. 2 0. 3 0. 4 0. 5 0. 6 0. 7 0. 8 0. 9 1
-150
-100
-50
0
50
Normal iz ed frequenc y (Ny quis t = = 1)
M
a
g
n
i
t
u
d
e

R
e
s
p
o
n
s
e

(
d
B
)
2006 Copyright 2006 Andreas Spanias 13-16-25
F.S. Design Rectangular vs Hamming Window - L=64
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-150
-100
-50
0
50
Normalized frequency (Nyquist == 1)
M
a
g
n
i
t
u
d
e

R
e
s
p
o
n
s
e

(
d
B
)
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-100
-50
0
50
Normalized frequency (Nyquist == 1)
M
a
g
n
i
t
u
d
e

R
e
s
p
o
n
s
e

(
d
B
)
Hamming
Rectangular
~45 dB
~13 dB
2006 Copyright 2006 Andreas Spanias 13-16-26
Truncating in time- frequency convolution and F.S. design
The main-lobe width determines transition characteristics
The sidelobe level determines rejection characteristics
Ideal LPF
Narrow mainlobe=
Narrower transition
Wide mainlobe =
Wide transition
2006 Copyright 2006 Andreas Spanias 13-16-27
Notes On Fourier Series Design
The design performed in the previous example involved truncation
of an ideal symmetric impulse response.A symmetric impulse
response produces a linear phase response.
Truncation involves the use of a window function which is
multiplied with the impulse response. Multiplication in the time
domain maps into frequency-domain convolution and the spectral
characteristics of the window function affect the design.
The main-lobe width determines transition characteristics
The sidelobe level determines rejection characteristics
2006 Copyright 2006 Andreas Spanias 13-16-28
Design of FIR Digital Filters
Lecture 15 - FIR DESIGN USING
THE KAISER WINDOW
Andreas Spanias
spanias@asu.edu
2006 Copyright 2006 Andreas Spanias 13-16-29
( )
2
f H
dp + 1
1
dp 1
ds
LPF Ideal
f
fp
fc
Passband band Transition
Stopband
Regions Tolerance
DEFINING DESIGN SPECIFICATIONS
fs
2006 Copyright 2006 Andreas Spanias 13-16-30
DESIGN USING THE KAISER WINDOW
The Kaiser window is parametric and its bandwidth as well as its sidelobe
energy can be designed. Mainlobe bandwidth controls the transition
characteristics and sidelobe energy affects the ripple characteristics.
1 0 ,
) (
1
) (
0
2 / 1
2
0
s s
|
|
|
.
|

\
|
(
(

|
.
|

\
|

= L n
I
n
I
n w
|
o
o
|
o = L/2 ; associated with the order of the filter
| is a design parameter that controls the shape of the window
I
0
(.) is a zeroth Bessel function of the first kind
2006 Copyright 2006 Andreas Spanias 13-16-31
DESIGN USING THE KAISER WINDOW (Cont.)
I x
k
x
k
k
0
2
1
1
1
2
( )
!
= +
|
\

|
.
|

(
=

_
25 terms from the Bessel function are sufficient
2006 Copyright 2006 Andreas Spanias 13-16-32
EXAMPLES OF KAISER WINDOW
0 20 40 60 80 100 120 140
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
|
0
1
2006 Copyright 2006 Andreas Spanias 13-16-33
KAISER WINDOW DESIGN EQUATIONS
Given f
p
, f
s
, T and dp, ds determine the FIR filter coefficients.
T f f
A
dp ds
p s
) ( 2
log 20
) , min(
10
= AO
=
=
t
o
o
The filter order is
) 2 (
285 . 2
8

AO

=
A
L
| =
>
+ s s
<

0 1102 8 7 50
0 5842 21 0 07886 21 21 50
0 21
0 4
. ( . ),
. ( ) . ( ),
,
.
A A
A A A
A
and the kaiser parameter is given by |
2006 Copyright 2006 Andreas Spanias 13-16-34
DESIGN PROCEDURE
1. Determine the cutoff frequency for the ideal Fourier Series
method.
f
f f
c
s p
=

2
2. Design the ideal LPF using the Fourier Series.
3. Design the Kaiser window
4. Shift and truncate the ideal impulse response
L n
L
n h n w n h
d LPF
s s
|
.
|

\
|
= 0 ,
2
) ( ) (
Note that this procedure can be generalized for the design of
BPF, HPF, and BSF.
2006 Copyright 2006 Andreas Spanias 13-16-35
Design by Zero-Placement
As zeros are placed towards the unit circle the frequency
response magnitude decreases at and in the vicinity of the
frequency of the zeros.
.
o
o
foldover
2006 Copyright 2006 Andreas Spanias 13-16-36
Design by Zero-Placement
Example: Design a linear phase FIR filter for 60Hz interference
cancellation, that will pass a 10Hz signal of interest without
attenuation. The sampling frequency is 500Hz.
25
6
500
60
2
25 500
10
2
60
10
t
t
t
t
= = O
= = O
A second order filter is sufficient, since only a zero pair on the
unit circle is required for 60Hz cancellation. The 10Hz response
is adjusted with a gain factor.
2006 Copyright 2006 Andreas Spanias 13-16-37
Design by Zero-Placement (Cont.)
A linear phase (steady state) design means symmetric impulse
response:
0 ) (
1 ) (
60 60 60
10 10 10
2
0 1 0
2
0 1 0
= + + =
= + + =
O O O
O O O
j j j
j j j
e b e b b e H
e b e b b e H
and
77 . 2 , 9 . 1
1 0
~ ~ b b
2006 Copyright 2006 Andreas Spanias 13-16-38
Design by Zero-Placement (Cont.)
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-50
0
50
100
150
Normalized frequency (Nyquist == 1)
P
h
a
s
e

(
d
e
g
r
e
e
s
)
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-60
-40
-20
0
20
Normalized frequency (Nyquist == 1)
M
a
g
n
i
t
u
d
e

R
e
s
p
o
n
s
e

(
d
B
)
-1 -0.5 0 0.5 1
-1
-0.5
0
0.5
1
Real part
Im
a
g
in
a
r
y

p
a
r
t
O
O
O O O
+ =
j j j
e e e H
2
9 . 1 77 . 2 9 . 1 ) (
2006 Copyright 2006 Andreas Spanias 13-16-39
Frequency Sampling Methods for FIR Filter design
The Frequency Sampling Method (FSM) involves: a) uniform
sampling of a desired continuous frequency response function at N
points, b) applying the N-point inverse Discrete Fourier Transform
to obtain an N-point impulse response.
The FSM guarantees that the FIR frequency response matches that
of the desired filter at the sampled points, however the response
between the sampled points is different. If the desired filter
function is due to an infinite impulse response then the FSM
suffers also from time-domain aliasing.
2006 Copyright 2006 Andreas Spanias 13-16-40
Min-Max and Parks-McClellan Optimum FIR Design
The Parks-McClellan design is based on Min-Max
Equiripple and linear phase design is possible
This class of methods involve minimizing the maximum error
between the designed FIR filter frequency response and a prototype
{ }
{ } ) ( max min
,..., 1 , 0 ), (
u j
L i i h
e E
=
where
E e W e H e H e
j j
d
j j
( ) ( )( ( ) ( ))
u u u u
=
2006 Copyright 2006 Andreas Spanias 13-16-41
FIR Filter Design Using MATLAB
+
IN THE MATLAB SP TOOLBOX
cremez - Complex and nonlinear phase equiripple FIR filter design.
fir1 - Window based FIR filter design - low, high, band, stop, multi.
fir2 - Window based FIR filter design - arbitrary response.
fircls - Constrained Least Squares filter design - arbitrary response.
fircls1 - Constrained Least Squares FIR filter design - low and highpass
firls - FIR filter design - arbitrary response with transition bands.
firrcos - Raised cosine FIR filter design.
intfilt - Interpolation FIR filter design.
kaiserord - Window based filter order selection using Kaiser window.
remez - Parks-McClellan optimal FIR filter design.
remezord - Parks-McClellan filter order selection.
+ MATLAB is registered trade mark of the MathWorks
2006 Copyright 2006 Andreas Spanias 13-16-42
FIR Filter Realizations
Direct Realizations
_
=

=
L
i
i
i
z b z H
0
) (
...
...
( ) n x
( ) n y
1
z
1
z
1
z
0
b
1
b 2
b
1 L
b
L
b
_
_ _ _
Require multiply accumulate instructions
2006 Copyright 2006 Andreas Spanias 13-16-43
FIR Filter Cascade Realizations
Cascade Realizations
[
=

+ + =
q
i
i i i
z b z b b z H
1
2
2
1
1 0
) ( ) (
...
1
z
1
z
1
z
1
z
_
_
_
_
10
b
11
b
12
b
20
b
21
b
22
b
( ) n x
Reduced Effects from Coefficient Quantization and round-off
In Fixed-Point implementation signal scaling must be
done carefully at each stage
2006 Copyright 2006 Andreas Spanias 13-16-44
Transform-Domain FIR Filter Realizations
A Transform domain realization is possible using the overlap
and save and the FFT. This yields computational savings for high
order implementations. Input data is organized in 2N-point blocks
and blocks are shifted N points at a time. The data blocks and
N zero-padded coefficients are transformed and multiplied and the
results is inverse transformed. The last N-points are selected as the
result. The blocks are updated and the process is repeated.
F F T I F F T
x y
-
X k ( 0 )
X k ( 1 )
X k ( L )
B k ( 0 )
B k ( 1 )
B k ( L )
Select Last N points
x(n)
y(n)
2006 Copyright 2006 Andreas Spanias 13-16-45
Transform-Domain FIR Filter Realizations (2)
Implements an N-th order filter with two 2-N point FFTs
For processing N points complexity is reduced from
O(N
2
) to O(Nlog
2
N)
FF T IF F T
x y
-
X k( 0 )
X k( 1 )
X k( L )
B k( 0)
B k (1 )
B k ( L)
Select Last N points
x(n)
y(n)
2006 Copyright 2006 Andreas Spanias 13-16-46
Simple and Smart FIR Filter Realizations
_
=

=
L
i
i
z
L
z H
0
1
) (
A simple L-tap filter can be built such that no multiplies are not used
This is a LPF with linear phase if L is radix 2 the division can be
implemented with shifts - below an example with L=16
0 0 . 1 0 . 2 0 . 3 0 . 4 0 . 5 0 . 6 0 . 7 0 . 8 0 . 9 1
- 2 0 0
- 1 0 0
0
1 0 0
N o r m a l i z e d f r e q u e n c y ( N y q u i s t = = 1 )
P
h
a
s
e

(
d
e
g
r
e
e
s
)
0 0 . 1 0 . 2 0 . 3 0 . 4 0 . 5 0 . 6 0 . 7 0 . 8 0 . 9 1
- 6 0
- 4 0
- 2 0
0
N o r m a l i z e d f r e q u e n c y ( N y q u i s t = = 1 )
M
a
g
n
it
u
d
e

R
e
s
p
o
n
s
e

(
d
B
)
2006 Copyright 2006 Andreas Spanias 13-16-47
Reducing Complexity by realizing FIR as IIR
) 1 (
1 1
) (
1
) 1 (
0

+
=

= =
_
z L
z
z
L
z H
L L
i
i
An FIR filter with all its coefficients equal can be realized by
looking at geometric series convergence and pole-zero cancellation
The IIR filter can be implemented using a simple difference equation
with long delay. Precision may become a problem as the pole zero
cancellation is on the unit circle.
1
( ) ( ( ) ( 1)) ( 1) y n x n x n L y n
L
= +
2006 Copyright 2006 Andreas Spanias 13-16-48
Pole-zero cancellation in FIR to IIR transformation
) 1 (
1 1
) (
1
) 1 (
0

+
=

= =
_
z L
z
z
L
z H
L L
i
i
-1 -0.5 0 0.5 1
-1
-0.5
0
0.5
1
Real part
I
m
a
g
i
n
a
r
y

p
a
r
t
Pole zero
cancellation at z=1
2006 Copyright 2006 Andreas Spanias 13-16-49
Modifying Filter Response by Subtractive Operations
) ( ) ( 1
O O
=
j
HPF
j
LPF
e H e H
__
=
t
HPF LPF ALL-PASS
t
c
O
c
O
c
O
c
O
Using simple operations like this we can transform prototype
LPF to HPF or BPF, etc.
2006 Copyright 2006 Andreas Spanias 13-16-50
Implementing Efficiently Digital Cross-Over Using
Subtractive Operations
LPF E to tweeter
to woofer Linear Phase LPF
With delay L/2 samples
-
+
could also implement delay compensation z
L/2
2006 Copyright 2006 Andreas Spanias 13-16-51
Frequency Sampling
/2

0 /4
Ideal frequency response
N=16 samples
/4

0
Sampled ideal frequency response
/4

0
Interpolated frequency response
(a)
(b)
(c)
1
2 /
0
( ) ( ) ( )
k
N
j j kn N
d d d
n
H k H e h n e
t

O
=
= =
_
( ) ( ) 0 1
d
k
h n h n kN n N

=
= + s s
_
; aliasing

Das könnte Ihnen auch gefallen