0% found this document useful (0 votes)
151 views17 pages

Advanced Training Course On FPGA Design and VHDL For Hardware Simulation and Synthesis

This document provides information about designing digital filters, including finite impulse response (FIR) filters. It discusses the five main steps in digital filter design: specification, coefficient calculation, realization, analysis of finite wordlength effects, and implementation. It also describes properties of FIR filters and methods for designing linear phase FIR filters. Linear phase FIR filters are classified into four types depending on whether the number of filter coefficients is even or odd and the symmetry of the coefficient function. Examples of coefficients and frequency responses are given for each type of linear phase FIR filter.

Uploaded by

MD Rocky
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
151 views17 pages

Advanced Training Course On FPGA Design and VHDL For Hardware Simulation and Synthesis

This document provides information about designing digital filters, including finite impulse response (FIR) filters. It discusses the five main steps in digital filter design: specification, coefficient calculation, realization, analysis of finite wordlength effects, and implementation. It also describes properties of FIR filters and methods for designing linear phase FIR filters. Linear phase FIR filters are classified into four types depending on whether the number of filter coefficients is even or odd and the symmetry of the coefficient function. Examples of coefficients and frequency responses are given for each type of linear phase FIR filter.

Uploaded by

MD Rocky
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

2065-27

Advanced Training Course on FPGA Design and VHDL for


Hardware Simulation and Synthesis

26 October - 20 November, 2009

Digital Signal Processing


Filter Design

Massimiliano Nolich
DEEI
Facolta' di Ingegneria Universita' degli Studi di Trieste
via Valerio, 10, 34127
Trieste
Italy
Filter design

1 Design considerations: a framework


|H(f)|

1 C ıp
1 ıp

ıs
f
0 fp fs

Passband Transition Stopband


band
The design of a digital filter involves five steps:
 Specification: The characteristics of the filter often have to be specified in
the frequency domain. For example, for frequency selective filters
(lowpass, highpass, bandpass, etc.) the specification usually involves
tolerance limits as shown above.
 Coefficient calculation: Approximation methods have to be used to
calculate the values hŒk for a FIR implementation, or ak , bk for an IIR
implementation. Equivalently, this involves finding a filter which has
H.z/ satisfying the requirements.
 Realisation: This involves converting H.z/ into a suitable filter structure.
Block or flow diagrams are often used to depict filter structures, and show
the computational procedure for implementing the digital filter.

1
 Analysis of finite wordlength effects: In practice one should check that
the quantisation used in the implementation does not degrade the
performance of the filter to a point where it is unusable.
 Implementation: The filter is implemented in software or hardware. The
criteria for selecting the implementation method involve issues such as
real-time performance, complexity, processing requirements, and
availability of equipment.

2 Finite impulse response (FIR) filter design


A FIR filter is characterised by the equations
N
X1
yŒn D hŒkxŒn k
kD0
N
X1
k
H.z/ D hŒkz :
kD0

The following are useful properties of FIR filters:


 They are always stable — the system function contains no poles. This is
particularly useful for adaptive filters.
 They can have an exactly linear phase response. The result is no frequency
dispersion, which is good for pulse and data transmission.
 Finite length register effects are simpler to analyse and of less
consequence than for IIR filters.
 They are very simple to implement, and all DSP processors have
architectures that are suited to FIR filtering.
 For large N (many filter taps), the FFT can be used to improve
performance.

2
Of these, the linear phase property is probably the most important. A filter is
said to have a generalised linear phase response if its frequency response can
be expressed in the form

H.e j! / D A.e j! /e j˛!Cjˇ

where ˛ and ˇ are constants, and A.e j! / is a real function of !. If this is the
case, then
 If A is positive, then the phase is

^H.e j! / D ˇ ˛!:

If A is negative, then

^H.e j! / D  C ˇ ˛!:

In either case, the phase is a linear function of !.


It is common to restrict the filter to having a real-valued impulse response hŒn,
since this greatly simplifies the computational complexity in the
implementation of the filter.
A FIR system has linear phase if the impulse response satisfies either the even
symmetric condition
hŒn D hŒN 1 n;
or the odd symmetric condition

hŒn D hŒN 1 n:

The system has different characteristics depending on whether N is even or


odd. Furthermore, it can be shown that all linear phase filters must satisfy one
of these conditions. Thus there are exactly four types of linear phase filters.

3
Consider for example the case of an odd number of samples in hŒn, and even
symmetry. The frequency response for N D 7 is
6
X
j! j!n
H.e /D hŒne
nD0
j! j 2! j 3! j 4!
D hŒ0 C hŒ1e C hŒ2e C hŒ3e C hŒ4e
j 5! j 6!
C hŒ5e C hŒ6e
j 3!
De .hŒ0e j 3! C hŒ1e j 2! C hŒ2e j! C hŒ3 C hŒ4e j!

j 2! j 3!
C hŒ5e C hŒ6e /:

The specified symmetry property means that hŒ0 D hŒ6, hŒ1 D hŒ5, and
hŒ2 D hŒ4, so

H.e j! / D e j 3!
.hŒ0.e j 3! C e j 3!
/ C hŒ1.e j 2! C e j 2!
/
C hŒ2.e j! C e j!
/ C hŒ3/
j 3!
De .2hŒ0 cos.3!/ C 2hŒ1 cos.2!/ C 2hŒ2 cos.!//
3
X
j 3!
De aŒn cos.!n/;
nD0

where aŒ0 D hŒ3, and aŒn D 2hŒ3 n for n D 1; 2; 3. The resulting filter
clearly has a linear phase response for real hŒn. It is quite simple to show that
in general for odd values of N the frequency response is
.N 1/=2
X
j! j!.N 1/=2
H.e /De aŒn cos.!n/;
nD0

for a set of real-valued coefficients aŒ0; : : : ; aŒ.N 1/=2. As different values


for aŒn are selected, different linear-phase filters are obtained.

4
The cases of N odd and hŒn antisymmetric are similar to that presented, and
the frequency responses are summarised in the following table:

Symmetry N H.e j! / Type

.N 1/=2
X
j!.N 1/=2
Even Odd e aŒn cos.!n/ 1
nD0

N=2
X
j!.N 1/=2
Even Even e bŒn cos.!.n 1=2// 2
nD1

.N 1/=2
X
j Œ!.N 1/=2 =2
Odd Odd e aŒn sin.!n/ 3
nD0

N=2
X
j Œ!.N 1/=2 =2
Odd Even e bŒn sin.!.n 1=2// 4
nD1

Recall that even symmetry implies hŒn D hŒN 1 n and odd symmetry
hŒn D hŒN 1 n. Examples of filters satisfying each of these symmetry
conditions are:

5
2

h [n]
0
1
−2
−1 0 1 2 3 4 5 6

2
h [n]

0
2

−2
−1 0 1 2 3 4 5 6

2
h [n]

0
3

−2
−1 0 1 2 3 4 5 6

2
h [n]

0
4

−2
−1 0 1 2 3 4 5 6
n

The center of symmetry is indicated by the dotted line.


The process of linear-phase filter design involves choosing the aŒn values to
obtain a filter with a desired frequency response. This is not always possible,
however — the frequency response for a type II filter, for example, has the
property that it is always zero for ! D , and is therefore not appropriate for a
highpass filter. Similarly, filters of type 3 and 4 introduce a 90ı phase shift, and
have a frequency response that is always zero at ! D 0 which makes them
unsuitable for as lowpass filters. Additionally, the type 3 response is always
zero at ! D , making it unsuitable as a highpass filter. The type I filter is the
most versatile of the four.
Linear phase filters can be thought of in a different way. Recall that a linear
phase characteristic simply corresponds to a time shift or delay. Consider now
a real FIR filter with an impulse response that satisfies the even symmetry
condition hŒn D hŒ n:

6
2

hŒn
1
0
−1
−5 0 5
n
6
H.e j! /

4
2
0
−2
−4
 0 
ω

Recall from the properties of the Fourier transform this filter has a real-valued
frequency response A.e j! /. Delaying this impulse response by .N 1/=2
results in a causal filter with frequency response

H.e j! / D A.e j! /e j!.N 1/=2


:

This filter therefore has linear phase.


2
hŒn

1
0
−1
−2 0 2 4 6 8
n
/j

5
j!
jH.e

0
 0 
ω
^H.e j! /

2
0

2
 0 
ω

7
2.1 Window method for FIR filter design

Assume that the desired filter response Hd .e j! / is known. Using the inverse
Fourier transform we can determine hd Œn, the desired unit sample response.
In the window method, a FIR filter is obtained by multiplying a window wŒn
with hd Œn to obtain a finite duration hŒn of length N . This is required since
hd Œn will in general be an infinite duration sequence, and the corresponding
filter will therefore not be realisable. If hd Œn is even or odd symmetric and
wŒn is even symmetric, then hd ŒnwŒn is a linear phase filter.
Two important design criteria are the length and shape of the window wŒn. To
see how these factors influence the design, consider the multiplication
operation in the frequency domain: since hŒn D hd ŒnwŒn,

H.e j! / D Hd .e j! /  W .e j! /:

The following plot demonstrates the convolution operation. In each case the
dotted line indicates the desired response Hd .e j! /.
/
/
W .e j.!

 0 !  2 3
θ
H.e j! /

 0  2 3
ω

From this, note that


 The mainlobe width of W .e j! / affects the transition width of H.e j! /.
Increasing the length N of hŒn reduces the mainlobe width and hence the

8
transition width of the overall response.
 The sidelobes of W .e j! / affect the passband and stopband tolerance of
H.e j! /. This can be controlled by changing the shape of the window.
Changing N does not affect the sidelobe behaviour.
Some commonly used windows for filter design are
 Rectangular: 8
<1 0nN
wŒn D
:0 otherwise

 Bartlett (triangular):

<2n=N
ˆ 0  n  N=2
wŒn D 2 2n=N N=2 < n  N
ˆ
0 otherwise

 Hanning:
8
<0:5 0:5 cos.2 n=N / 0nN
wŒn D
:0 otherwise

 Hamming:
8
<0:54 0:46 cos.2 n=N / 0nN
wŒn D
:0 otherwise

 Kaiser:
8
<I Œˇ.1
0 Œ.n ˛/=˛2 /1=2  0nN
wŒn D
:0 otherwise

Examples of five of these windows are shown below:

9
1
Rectangular
Triangular
wŒn
0.5

0
0 N/2 N
n

1
Hanning
Hamming
wŒn

0.5 Blackman

0
0 N/2 N
n

All windows trade off a reduction in sidelobe level against an increase in


mainlobe width. This is demonstrated below in a plot of the frequency
response of each of the windows:
20 log10 jW .e j! /j

0
Rectangular
Triangular
−50

−100
0 
ω
20 log10 jW .e j! /j

0
Hanning
Hamming
−50 Blackman

−100
0 
ω

Some important window characteristics are compared in the following table:

10
Window Peak sidelobe Mainlobe Peak approximation
amplitude (dB) transition width error (dB)
Rectangular 13 4=.N C 1/ 21
Bartlett 25 8=N 25
Hanning 31 8=N 44
Hamming 41 8=N 53
The Kaiser window has a number of parameters that can be used to explicitly
tune the characteristics.
In practice, the window shape is chosen first based on passband and stopband
tolerance requirements. The window size is then determined based on
transition width requirements. To determine hd Œn from Hd .e j! / one can
sample Hd .e j! / closely and use a large inverse DFT.

2.2 Frequency sampling method for FIR filter design

In this design method, the desired frequency response Hd .e j! / is sampled at


equally-spaced points, and the result is inverse discrete Fourier transformed.
Specifically, letting

H Œk D Hd .e j! /ˇ!D 2k ;


ˇ
k D 0; : : : ; N 1;
N

the unit sample response of the filter is hŒn D IDFT.H Œk/, so


N 1
1 X
hŒn D H Œke j 2 nk=N :
N
kD0

The resulting filter will have a frequency response that is exactly the same as
the original response at the sampling instants. Note that it is also necessary to
specify the phase of the desired response Hd .e j! /, and it is usually chosen to
be a linear function of frequency to ensure a linear phase filter. Additionally, if

11
a filter with real-valued coefficients is required, then additional constraints
have to be enforced.
The actual frequency response H.e j! / of the filter hŒn still has to be
determined. The z-transform of the impulse response is
NX1 NX1 1 NX1
" #
H.z/ D hŒnz n D H Œke j 2 nk=N z n
nD0 nD0
N
kD0
N 1 N
X1
1 X
D H Œk e j 2 nk=N z n
N nD0
kD0
N 1
1 z N
 
1 X
D H Œk :
N 1 e j 2k=N z 1
kD0

Evaluating on the unit circle z D e j! gives the frequency response


N 1
j! 1 e j!N X H Œk
H.e /D :
N 1 e j 2k=N e j!
kD0

This expression can be used to find the actual frequency response of the filter
obtained, which can be compared with the desired response.
The method described only guarantees correct frequency response values at the
points that were sampled. This sometimes leads to excessive ripple at
intermediate points:

12
1.2

0.8
jH.e j! j

0.6

0.4

0.2 Actual
Desired
0
0  2
ω

One way of addressing this problem is to allow transition samples in the


region where discontinuities in Hd .e j! / occur:

T1
T2
T3

Passband Transition band Stopband

This effectively increases the transition width and can decrease the ripple, as
observed below:

13
1.2

0.8
jH.e j! j

0.6

0.4

0.2 Actual
Desired
0
0  2
ω

By leaving the value of the transition sample unconstrained, one can to some
extent optimise the filter to minimise the ripple. Empirically, with three
transition samples a stopband attenuation of 100dB is achievable. Recall
however that for hŒn real we require even or odd symmetry in the impulse
response, so the values are not entirely unconstrained.

2.3 Optimum approximations of FIR filters

This method of filter design attempts to find the filter of length N that
optimises a given design objective. In this case the objective is chosen to be the
minimisation of
max jE.e j! /j
0!2

where E.e j! / is a weighted error function

E.e j! / D W .e j! /ŒHd .e j! / H.e j! /:

The minimisation is performed over the filter coefficients hŒn.


In practice, the design problem can be specified as follows: given ıp , ıs , fp ,
and fs , determine hŒn such that the design specification is satisfied with the
smallest possible N . The optimal (or minimax) design method therefore yields

14
the shortest filter that meets a required frequency response over the entire
frequency range. It is widely used in practice.
Solutions to this optimisation problem have been explored in the literature, and
many implementations of the method are available. It turns out that when
max jE.e j! /j is minimised, the resulting filter response will have equiripple
passband and stopband, with the ripple alternating in sign between two equal
amplitude levels:

−40

−50

−60
jH.e j! j

−70

−80

−90

−100
0 
ω

The maxima and minima are known as extrema. For linear phase lowpass
filters, for example, there are either r C 1 or r C 2 extrema, where
r D .N C 1/=2 (for type 1 filters) or r D N=2 (for type 2 filters).
For a given set of filter specifications, the locations of the extremal
frequencies, apart from those at band edges, are not known a priori. Thus the
main problem in the optimal method is to find the locations of the extremal
frequencies. Numerous algorithms exist to do this. Once the locations of the
extremal frequencies are known, it is simple to specify the actual frequency
response, and hence find the impulse response for the filter.

15
3 Infinite impulse response (IIR) filter design

An IIR filter has nonzero values of the impulse response for all values of n,
even as n ! 1. To implement such a filter using a FIR structure therefore
requires an infinite number of calculations.
However, in many cases IIR filters can be realised using LCCDEs and
computed recursively.
Example:
A filter with the infinite impulse response hŒn D .1=2/n uŒn has z-transform
1 Y .z/
H.z/ D 1
D :
1 1=2z X.z/
Therefore, yŒn D 1=2yŒn 1 C xŒn, and yŒn is easy to calculate.
IIR filter structures can therefore be far more computationally efficient than
FIR filters, particularly for long impulse responses.
FIR filters are stable for hŒn bounded, and can be made to have a linear phase
response. IIR filters, on the other hand, are stable if the poles are inside the
unit circle, and have a phase response that is difficult to specify. The general
approach taken is to specify the magnitude response, and regard the phase as
acceptable. This is a disadvantage of IIR filters.
IIR filter design is discussed in most DSP texts.

16

You might also like