Вы находитесь на странице: 1из 53

1

introduction to
FIR
digital filters design




Prepared by:
INFOTECH Seminar Report Imtiaz Sharif
Maximiliano Casas
Professor Dr.B.Yang
M.Sc.Setiyanto July 2002



2
agenda

Introduction.
Digital Filter design.
FIR filters.
Some design methods.
General considerations.
FIR filter design by windowing.
Design of Minimum-Phase FIR filters.
Design of FIR filter in the Minimax Sense.
Design FIR filters using Periodic Subfilters as Basic
Building Blocks.
Maximally Flat FIR Filters.

Summary.


3
introduction
The function of a filter is to remove unwanted parts of the
signal or to extract useful parts of it .




A digital filter uses digital signals to perform this purpose.
Easily designed, tested and implemented.
Extremely robust with respect both to time and temperature.
More versatile to adapt to changes in the signal characteristics.
Hardware requirements are relatively simple and compact.

This is an introduction of a particular kind of filters, FIR filters.


FILTER

Desired Signal
(filtered)
Raw Signal
(unfiltered)
4
digital filter design
Iterative process:

Determine the desired response.
Choose the class of filter we want to use.
Set up a criterion of righteousness for the response of a filter in
the selected class.
Develop a method for finding the best member in the class
chosen.
Implementation of the best filter using the proper form , such
as computer program, digital signal processor or VLSI chip.
Control and analysis of the filter performance.

5
index of contents

Introduction.
Digital Filter design.
FIR filters.
Some design methods.
General considerations.
FIR filter design by windowing.
Design of Minimum-Phase FIR filters.
Design of FIR filter in the Minimax Sense.
Design FIR filters using Periodic Subfilters as Basic Building
Blocks.
Maximally Flat FIR Filters.

Summary.


6
FIR filters

Finite Impulse Response Filters are digital filters where there is
no feedback.
To decide the type of filter is one of the most significant steps.
Among FIR and IIR filters we can find advantages and
disadvantages.
With the actual stage of technology and the improvements of
computer science and digital circuits, FIR is becoming more
relevant in the digital filter implementation.


7
FIR filters
Advantages/Disadvantages (Compared to IIR filters)
Advantages:
FIR filters are inherently stable!.
They can easily be designed to be "linear phase".
They have advantageous numeric properties. No accumulation
of errors!!
The use of finite-precision arithmetic in IIR filters can cause
significant problems due to the use of feedback. FIR filters can
usually be implemented using fewer bits.
They can be implemented using fractional arithmetic. This is an
important consideration when using fixed-point DSP's, because it
makes the implementation much simpler.

Disadvantages: Memory requirements!

8
index of contents

Introduction.
Digital Filter design.
FIR filters.
Some design methods.
General considerations.
FIR filter design by windowing.
Design of Minimum-Phase FIR filters.
Design of FIR filter in the Minimax Sense.
Design FIR filters using Periodic Subfilters as Basic Building
Blocks.
Maximally Flat FIR Filters.

Summary.


9
Some design methods. General considerations 1.
Definitions.

[0,e
p
] is desired to preserve the input signal
[e
s
,t] is desired to remove the input signal
[e
p
, e
s
] region where output changes from
unity between bands.
10
Some design methods. General considerations 2.
The goal is to get a linear phase response in the passband
region [0,e
p
], and a short width transition band [e
p
,e
s
].

11
Some design methods. General considerations 3.
Filter response vs Desired response. Especifications


( ) ( ) ( ) ( ) ( ) e e e e
e
p p
j
p p
e D e H e D + s s ( )
p
e e , 0 e
( ) ( ) e
e
s
j
e e H s
( ) t e e ,
s
e
( ) ( ) ( ) ( ) | | e e e
e
D e H W E
j
= ( ) t e , 0 e
12
index of contents

Introduction.
Digital Filter design.
FIR filters.
Some design methods.
General considerations.
FIR filter design by windowing.
Design of Minimum-Phase FIR filters.
Design of FIR filter in the Minimax Sense.
Design FIR filters using Periodic Subfilters as Basic Building
Blocks.
Maximally Flat FIR Filters.

Summary.


13

Some design methods.
FIR filter design by windowing.1
The frequency response of any digital filter is periodic in
frequency.

Let us consider the case of an ideal lowpass filter.





If we develop a discrete frequency response expression for the
low-pass and have the inverse DFT we reach to the sinc
function


( ) ( )
j
- n
j
e n h e H

=
( )
( )
n
n sin
n h
c
c c
e
e
t
e
=
14

Some design methods.
FIR filter design by windowing.2
We can approximate our filter coefficients by multiplying the
ideal filter coefficients with a window function w(n):


w(n) is a window function that is zero except the range [-M,M]

We can approximate the sinc function using a sequence of
finite-length set of unity values i,e. a Rectangular Window with
finite length

The length of w(n) is the number of coefficients, or taps, we
intend to use to implement our filter

( ) ( ) ( ) n w n h n h
1
=
15

Some design methods.
FIR filter design by windowing.3
Graphical representation of the windowing.










The waveform is now truncated to 2M+1 points symmetrically
chosen around the main lobe. All samples outside this points are
simply ignored


) (
e j
e H
) (
e j
e W
) (
1
e j
e H
16

Some design methods.
FIR filter design by windowing.4
Ripples in the passband and poor attenuation in the stopband.


) (
1
e j
e H
17

Some design methods.
FIR filter design by windowing.5
To choose the desirable window characteristics we have to
consider:
the discontinuities in H(e
je
) have become the transition bands on
either sides.
the width of the transition bands depends on the width of the
main lobe of the W(e
je
).
the maximum passband deviation from unity and the maximum
stopband deviation from zero are about the same
the peak passband overshoot (1+o) and the peak negative
stopband undershoot (-o ) occur at the same distance form the
discontinuity point e
c
.
the distance between two overshoot points is for most windows
approximately equal to the mainlobe width .
the ripples caused by the sidelobes.


18

Some design methods.
FIR filter design by windowing.6
So our desirable window characteristics are:

the main lobe of the frequency response of the window should be
as narrow as possible containing as much of the total energy
possible.

the area under the sidelobes should be small and decrease rapidly
as et

In reality the above mentioned characteristics contradict each
other.


19

Some design methods.
FIR filter design by windowing.7
Fixed window functions comes from the Rectangular, Bartlett,
Hamming, Blackman window where the only adjustable
parameter is the M.
the transition bandwidth is inversely proportional to the filter
order 2M








Blackman window for M=128 and
c
=0.4 .

) 2 /( M
p s
e e e ~ = A
2
s p
c
e e
e
+
=
20

Some design methods.
FIR filter design by windowing.8
Therefore comes the idea of adjustable window functions where
an additional parameter A
s
can be varied.
Different approaches are prevalent for this purpose.
To minimize the energy in the sidelobes of the frequency response
of the window function.
To minimize the peak sidelobe ripple.
To combine the above mentioned approaches.

The Kaiser window and the Saramki window provide optimal
solutions for the first approach
The Dolph-Chebyshev window is the solution of the second
approach.

21

Some design methods.
FIR filter design by windowing 9. Kaiser Window
It has a response:





o is the adjustable parameter and is the modified zero-
order bessel function of the first kind .
Adjustable parameters (o for Kaiser window) can be determined
to have desired value of A
s
, whereas M can be determined to
have the required transition bandwidth.

s s
(
(

|
.
|

\
|

=
otherwise , 0
M n M - ), ( 1
) (
0
2
0
o o I
M
n
I
n w
) (
0
x I
22

Some design methods.
FIR filter design by windowing 10.Kaiser Window
Example of Kaiser Window with different values of o:

23
index of contents

Introduction.
Digital Filter design.
FIR filters.
Some design methods.
General considerations.
FIR filter design by windowing.
Design of Minimum-Phase FIR filters.
Design of FIR filter in the Minimax Sense.
Design FIR filters using Periodic Subfilters as Basic Building
Blocks.
Maximally Flat FIR Filters.

Summary.


24
Some design methods.
Design of Minimum-Phase FIR filters.(motivation,1)
A linear phase filter has a constant delay and thus the
characteristics of having no phase distortion to the signal.
Sometimes the linearity of the phase response becomes less
important as a consequence of the delay these filters exhibits.
The delay equals half the order of the filter which implies that in
case of a narrow transition band the delay might be too long.
In such cases it might be valuable to allow a smaller group delay or
the phase to be arbitrary or else to set it in such a way that the
amplitude response is made easier to achieve by the use of a
minimum phase filter.



25
Some design methods.
Design of Minimum-Phase FIR
filters.(motivation,2)
An LTI filter is said to be minimum phase if all its poles and
zeros are inside the unit circle |Z|=1.
A minimum phase filter is also causal since non-causal terms in
the impulse response correspond to poles at infinity.

A non-minimum-phase pole-zero system can be expressed as:




) ( ). ( ) ( z S z H z H mp =
26
Some design methods.
Design of Minimum-Phase FIR
filters.(motivation,3)
We consider a single non minimum phase zero of H(z)
| |>1 and H(z) can be written with the non-minimum-phase
zero factored out as :
H(z)=H
1
(z) (1- z
-1
)
Which can be factored as :




In the H
2
(z) the non-minimum-phase zero has been reflected
inside the unit circle to become minimum-phase (from z= to
z=1/)



) - (1
) - (1
) (
) - (z)(1 H H(z)
1 1
1
2
1 1
1


=
z
z
z H
z
|
|
|

27
Some design methods.
Design of Minimum-Phase FIR
filters.(motivation,4)
Group delay of non minimum-phase systems:

Based on the decomposition of a nonminimum-phase system we
can express the group delay of H(z) as:


Since so
we conclude that among all pole-zero systems having the same
magnitude response, the minimum-phase system has the
smallest group delay.




) ( ) ( ) ( e t e t e t
ap
g
mp
g g
+ =
t e e t s s > 0 for 0 ) (
ap
g
t e e t e t s s > 0 , ) ( ) (
mp
g g
28
Some design methods.
Design of Minimum-Phase FIR filters.(design,1)
We start from a real amplitude response which in principle can
be carried out by factoring H(z) and reflecting all zeros which
are outside the unit circle into the unit circle.
For instance a non linear phase FIR filter with transfer function:


a transfer function which has reciprocal zeros would be:




n
z

=
M
0 n
h[n] H(z)
n M
z z H z

=

= =
M
0 n
1
r n] - h[M ) ( (z) H
29
Some design methods.
Design of Minimum-Phase FIR filters.(design,2)

We develop a transfer function G(z) such that G(z)=H(z)H
r
(z) is
a transfer function of a linear phase filter of order 2M.

Since G(z) has double zeros on the unit circle, G() also has
double zeros on [0,t]
Therefore the design of a non linear phase FIR filter of order M
can be accomplished in terms of a type I linear-phase filter with
an order of 2M having double zeros on the unit circle.

Based on the above mentioned facts Herrmann and Schussler
have proposed a design procedure.

30
Some design methods.
Design of Minimum-Phase FIR filters. Procedure
To design a type I linear phase FIR filter transfer function of
order 2M using the MPR algorithm such that oscillates
within the limits in the passband [0, e
p
] and within the
limits in the stop band [e
s ,
t]. This G(z) has single zeros on
the unit circle.

To form . On [0, e
p
], G(e) oscillates within the
limits . G(e) has double zeros at those frequency points
where takes the stopband minimum value of . So the
G(z) has double zeros on the unit circle at those frequencies.
To factorise the such that H(z) contains the
zeros inside the unit circle and one each of the double zeros on
the unit circle and to scale H(z) such that the passband average
of the resulting filter is equal to unity.

) z ( G
) ( G e
p 1 o
s o
) z ( G z ) z ( G
M
s + o =

p s 1 o o +
) ( G e
) z ( H . z ) z ( H ) z ( G
1 M
=
s o
31
index of contents

Introduction.
Digital Filter design.
FIR filters.
Some design methods.
General considerations.
FIR filter design by windowing.
Design of Minimum-Phase FIR filters.
Design of FIR filter in the Minimax Sense.
Design FIR filters using Periodic Subfilters as Basic Building
Blocks.
Maximally Flat FIR Filters.

Summary.


32
Some design methods.
Design of FIR filter in the Minimax Sense.
Also called Chebyshev approximation .
The weighted function will be given by the equation:


We will minimize the maximum absolute value of E(e)
expressed as:


If the maximum c is given we should find the minimum order of
a filter to reach it. Optimize!!

There are several standard optimization procedures.



( ) ( ) ( ) ( ) | | e e e
e
D e H W E
j
=
( ) e c E max =
33
Some design methods.
Design of FIR filter in the Minimax Sense.
Alternation Theorem for Optimal Chebyshev approximation

If H(e) is a linear combination of M cosine functions:

A necesary and sufficient condition that H(e) be the unique best
weighted Chebyshev approximation to a continuous function
D(e) over a subset O of [0,t] is that the weighted error
function

exhibit at least M alterations within O .
there must be at least M+1 distinct points e
I
where the
weighted error attains its maximum value at each e
I

Alternatively +c and -c

These M+1 points are called extremal frequencies
.







( )

e | = e

=
1 M
0 k
k
) k cos( H
( ) ( ) ( ) ( ) | | e e e
e
D e H W E
j
=
( ) e c E max =
34
Some design methods.
Design of FIR filter in the Minimax Sense.
Alternation Theorem for Optimal Chebyshev approximation

Example:
35
Some design methods.
Design of FIR filter in the Minimax Sense.
Non linear equation solutions

At each of the N
e
unknown extremal frequencies E(e) attains
the maximum value +c or the minimum -c and E(e) has zero
derivative.




Two N
e
equations representing a set of nonlinear equations.
It can be solved using a nonlinear optimisation procedure such
as Fletcher-Powell algorithm
Problems:
we do not get to minimize o
There are no way to specify band edges for the different frequency
bands of the filter.



| | 0 ) ( E
d
d
i
= e
e
e = e
( ) ( ) ( ) ( ) | | e e e
e
D e H W E
j
=
36
Some design methods.
Design of FIR filter in the Minimax Sense.
The Remez Exchange Algorithm.1
We desire a method capable of designing any optimal (minimax)
filter
Produces a Chebyshev approximation whose actual frequency
response is as close as possible to the desired response for a
given number of filter taps.
Using the alternation theorem that gave a set of necessary and
sufficient conditions.
A general filter design program consist of:
Define desired response, weighting function and filter duration.
Formulation of the appropiate equivalent approximation problem.
Solution of the approximation problem using the Remez exchange
Algorithm.
Calculation of the filter impulse response.


37
Some design methods.
Design of FIR filter in the Minimax Sense.
The Remez Exchange Algorithm.2
From the initial specification of the problem, we have tha the
set of M+1 points O should solve the set of equations:



This equations allow us to calculate o
We use interpolation on the M+1 points to get H(e)
We calculate the error on each of the M+1 frequencies, if this
is less than o we finish if not we iterate with a new set of M+1
points (peaks of the resulting error curve, forcing o to increase
and converge to the upper bound)

Case of having more than M+1 at any iteration is taken into
account.


( ) ( ) ( ) | | o = e e
e k j
) 1 ( D e H W
38
Some design methods.
The Remez Exchange Algorithm.3






























Initial guess of M+1 extremal
frequencies
Calculate the optimum o on
extremal set
Interpolate thru M points to
obtain H(e)
Calculate the error E(e) and find
Local Maxima where |E(=)|>=o
More than
M+1 extrema?
Check whether the extremal
points changed
Retain M+1
Largest extrema
YES
NO
Changed
Unchanged
Best approximation!!!
39
index of contents

Introduction.
Digital Filter design.
FIR filters.
Some design methods.
General considerations.
FIR filter design by windowing.
Design of Minimum-Phase FIR filters.
Design of FIR filter in the Minimax Sense.
Design FIR filters using Periodic Subfilters as Basic Building
Blocks.
Maximally Flat FIR Filters.

Summary.


40
Some design methods. Design FIR filters using
Periodic Subfilters as Basic Building Blocks.
In order to decrease the cost of implementation of an FIR filter,
this technique using subfilters whose transfer function is :
F(z
L
)

Among the different techniques we will mention some of them:

Periodic Filters

Frequency-Response Masking Approach

41
Some design methods.
Periodic Filters

We consider a conventional transfer function:


replacing z
-1
by z
-L
, we get



Thus the periodicity of A(e) is : 2t/L
A(e) will have several transitions bands of width

Those can be used as a transition band for a low pass filter.


| |
n
N
n
z n f z F
F

=
0
) (
( ) | |
nL
N
n
L
z n f z F z A
F

= =
0
) ( ( ) ( ) e e L F A =
( )
L
u |
42
Some design methods.
Periodic Filters




43
Some design methods.
Frequency-Response Masking Approach 1
In this case we will use two functions and to build the transfer
function:


The zero-phase frequency response of this filter can be written
as:



with the same delay the response of each function is :


( ) ( ) | | ( ) z G z F z z G z F z H
L LN L
F
2
2 /
1
) ( ) ( + =

( ) ( ) | | ( ) e e e e e
2 1
) ( 1 ) ( G L F G L F H + =
44
Some design methods.
Frequency-Response Masking Approach 2

45
Some design methods.
Frequency-Response Masking Approach 3










How?


From one function ( ) e F with a transition band of u |

A second function
( ) e
1
G
with
| | L l
G
p
/ 2
1
u t e + =

| | L l
G
s
/ ) 1 ( 2
1
| t e + =


A third function
( ) e
2
G
with
| | L l
G
p
/ 2
2
u t e =

| | L l
G
s
/ 2
2
| t e + =

( ) | | t e 2 /
s
L l =
s
L l e t u = 2 p
L l e t | = 2
46
index of contents

Introduction.
Digital Filter design.
FIR filters.
Some design methods.
General considerations.
FIR filter design by windowing.
Design of Minimum-Phase FIR filters.
Design of FIR filter in the Minimax Sense.
Design FIR filters using Periodic Subfilters as Basic Building
Blocks.
Maximally Flat FIR Filters.

Summary.


47
Some design methods.
Maximally Flat FIR Filters.

One simple method of designing the FIR filters is to use filters
with maximally flat response around =0 and =t.
Maximally Flat FIR digital filters are frequency-selective discrete-
time systems.
Important because of the monotone and flat frequency
response these filters exhibits.
Are useful in applications where the signal is desired to be
preserved with very small error near the zero frequency.

48
Some design methods.
Maximally Flat FIR Filters. General Characteristics

Flat at the centres of flatness. Usually monotone.
Both linear phase and non-linear phase filters exist. However
the phase response is always flat at the centre of flatness.
Transition band is wider than the filters that are designed
according to minimax or least squares criteria.

We consider a Type I filter with transfer function :




,
n
z

=
2M
0 n
h[n] H(z)
h[2M-n]=h[n]
49
Some design methods.
Maximally Flat FIR Filters.

lt is advantageous to express H(e) as an M th degree
polynomial in cos e



Alternatively the transfer functions can be expressed in the
following form:




H(e) has 2K zeros: e =t
H(e)-1 has 2L=2(M-K+1) zeros: e =0


) 2 / ( sin d[n] ) 2 / ( cos ) H(
2n
1 - L
0 n
2K

=
=
) 2 / ( cos [n] d ) 2 / ( sin 1 ) H(
2n
1 - K
0 n
2L

=
=

n
n L
K
z
z
z
2
1
) 1 (
1 - L
0 n
n
2
1
2
1
d[n] (-1)
2
1
H(z)
|
.
|

\
|

|
.
|

\
|
+
=


=

n
n K
L
M
z
z
z
z
2
1
) 1 (
1 - K
0 n
2
1
L
2
1
[n] d
2
1
(-1) H(z)
|
.
|

\
|
+
|
.
|

\
|

=


=

50
Some design methods.
Maximally Flat FIR Filters.

Now the issue is to determine the variables from the given
specifications. Kaiser has stated the specifications for maximally
flat filters as shown :


,
filter Order 50 with =0.4t and =0.2t.
The lower estimate for
M=K+L-1 (half the filter
order) is given by:
M
lower
= (t/)
2

is given by :
=(1+cos)/2
K

<M

>

K= K

, L= M
-
K

, M= M
-1


51
Summary1

So far we have discussed several techniques of designing FIR
filters.
Each of this techniques have their own advantages and
drawbacks.

The windowing is the easiest of all the methods mentioned. But
for filters designed using this method, the passband and
stopband ripple are approximately same.

Maximally flat filters are very useful in application where the
signal should be preserved very accurately near the zero
frequency. For applications requiring very narrow transition
characteristics, maximally flat filters is not a suitable option.

52
Summary 2
Among all pole-zero systems having the same magnitude
response, the minimum-phase system has the smallest group
delay but it looses the quality of having linear phases
characteristics.

If the maximum deviation from the given response is of main
interest, then filters designed in the minimax sense meet the
criteria with a significantly reduced filter order. The Remez
Exchange Algorithm is the moxt powerful method for designing
arbitrary-magnitude FIR filters in the minimax sense.

Therefore the appropriate design method of an FIR should
depend on how its parameters are specified, the type of
precision it requires depending on its usage.

53



Thank you.

Вам также может понравиться