Sie sind auf Seite 1von 12

Lecture 5 - Digital Filters

5.1 Digital filtering


Digital filtering can be implemented either in hardware or software; in the first
case, the numerical processor is either a special-purpose chip or it is assembled out
of a set of digital integrated circuits which provide the essential building blocks of
a digital filtering operation storage, delay, addition/subtraction and multiplication by constants. On the other hand, a general-purpose mini-or micro-computer
can also be programmed as a digital filter, in which case the numerical processor
is the computers CPU and memory.
Filtering may be applied to signals which are then transformed back to the
analogue domain using a digital to analogue convertor or worked with entirely in
the digital domain (e.g. biomedical signals are digitised, filtered and analysed to
detect some abnormal activity).

5.1.1 Reasons for using a digital rather than an analogue filter


The numerical processor can easily be (re-)programmed to implement a
number of different filters.
The accuracy of a digital filter is dependent only on the round-off error in
the arithmetic. This has two advantages:
the accuracy is predictable and hence the performance of the digital
signal processing algorithm is known a priori.
The round-off error can be minimized with appropriate design techniques and hence digital filters can meet very tight specifications on
magnitude and phase characteristics (which would be almost impossible to achieve with analogue filters because of component tolerances
and circuit noise).
59

The widespread use of mini- and micro-computers in engineering has greatly


increased the number of digital signals recorded and processed. Power supply and temperature variations have no effect on a programme stored in a
computer.
Digital circuits have a much higher noise immunity than analogue circuits.

5.1.2 The sampling process


This is performed by an analogue to digital converter (ADC) in which the contin
 

uous
function
is
replaced
by
a
discrete
function
, which is defined only




at 
, with
. We thence only need consider the digitised sample
set
and the sample interval .
Aliasing

!#"$ %'& 

)!#"*,+-.
$% & 

( (one cycle every 4 samples) and also


(
Consider
(3 cycles every 4 samples) as shown in Fig. 5.1. Note that the resultant samples
are the same. This result is referred to as aliasing. The most popular solution
to this problem is to precede the digital filter by an analogue low-pass filter to
0/#0
ensure that any frequency above
Hz is adequately suppressed. (This LPF
is known as an anti-aliasing filter and is shown to the left of the1 A/D
23/4 converter
on the block diagram of page 46). Without an anti-aliasing filter,
Hz at the
152#/4
156#/4
output could have been produced either by
Hz at the input.
7186#/0 Hz or
With the anti-aliasing filter, any signal at
Hz will be suppressed prior to
1 23/4
1 23/4
A/D conversion, i.e.
coming out must represent
going in. Since we
cannot build perfect anti-aliasing filters, however, digital filters will normally have
0/4
their passband well below
Hz.
5.1.3 Reconstruction of output waveform
The data at the output of the D/A converter must be interpolated in order to reconstruct the filtered signal. Usually this takes the form of step or one-point interpolation (in which the value at the sample time is assumed to be the value of the
function until the next sample time), followed by analogue low-pass filtering as
shown in Fig. 5.2. The output low-pass filter is sometimes known as a recovery
filter.

60

0.5

0.5

10

20

30

40

50

60

70

80

90

100

10

20

30

40

50

60

70

80

90

100

0.5

0.5

Figure 5.1: Aliasing.

5.2 Introduction to the principles of digital filtering


We can see that the numerical processing is at the heart of the digital filtering
process. How can the arithmetic manipulation of a sequence of numbers produce
a filtered version of that sequence? Consider the noisy signal of figure 5.3,
together with its sampled version:
One way to reduce the noise might be to try and smooth the data. For example,
we could try a polynomial fit using a least-squares criterion. If we choose, say, to
fit a parabola to every group of 5 points in the sequence, then, for every point, we
will make a parabolic approximation to that point using the value of the sample at
that point together with the values of the 4 nearest samples (this forms a parabolic
filter), as in Fig. 5.4

%
9 
:);<>=?
@;BAC=?
; %



DFEHGI GJK#K L

where 9
;<*;BAK=; % value of parabola at each of the 5 possible values of
and
are the variables used to fit each of the parabolae to 5 input data
points.
61

samples
DAC
LPF
Figure 5.2: Reconstruction using a DAC and LPF.

-2

-1 0

Figure 5.3: Noisy data.

;< ;BA

;%

We obtain a fit by finding a parabola (coefficients ,


and ) which best
approximates the 5 data points as measured by the least-squares error E:

% %
M N;<K;A,K; % O P T>
UGV;<>=?
@;BAC=?
; % W
QKR:S %

Minimizing the least-squares error gives:

X M
X M
Y7
Z7
X ;<
X B; A

X M
Y
and X ; %
QKR %

and thus:

[ ;< =\*3; %  P T>



QKR:S %
Q]R %
*3;BA P
T>

QKR:S %
62

parabolic fit

-2 -1 0

1 2
centre point, k=0

Figure 5.4: Parabolic fit.

QKR %

%
*3;<>=^2B_H; %  P
T>
H
Q]R:S %
which therefore gives:

;<

2[

`Ga24T>bGa4 =V00T>bGc! =\064T>dB =V*4T>be fGg2BT>4 


;BAh

;% 


`GI4T>iGa4 UGjT>bGc! 7=kT>b! H=?4T>4 W
* 


N4T>iGI0 UGjT>bGc! UGg4T>dB UGlT>i! 7=^4T> 0 
 _

The centre point of the parabola is given by:

%
9 
Om QKR <KY;*<>=^
@;BAn=^
; % m QKR <Z;*<
;<

Thus, the parabola coefficient given above is the output sequence number
calculated from a set of 5 input sequences points. The output sequence so obtained is similar to the input sequence, but with less noise (i.e. low-pass filtered)
because the parabolic filtering provides a smoothed approximation to each set of
five data points in the sequence. Fig. 5.5 shows this filtering effect. The magnitude response (which we will re-consider later) for the 5-point parabolic filter is
shown below in Fig. 5.6.
The filter which has just been described is an example of a non- recursive digital filter, which are defined by the following relationship (known as a difference
63

1.5

0.5

0.5

10

20

30

40

50

60

70

80

90

100

Figure 5.5: Noisy data (thin line) and 5-point parabolic filtered (thick line).
1

|H(z)|

0.8
0.6

fsamp / 2

0.4
0.2
0

100

200

300

400

500

600

700

Figure 5.6: Frequency response of 5-point parabolic filter.


equation):

r
P
r
>T 
uGkvw
o 
p q
<R s
t

where the s coefficients determine the filter characteristics. The difference equation for the 5-point smoothing filter, therefore, is:


o 
p 2 [ x Gy2BT>
J=^4 =\04T>
c=\! =\064T>
7=V00T>
uGz! fGj2BT>
{G|4 W


This is a non-causal filter since a given output value o
T>

T>depends

}=k! not only on
, the input
and the input
previous inputs, but also on the current input
T>
~={4


. The problem is solved by delaying the calculation of the output value o
(the centre point of the parabola) until all the 5 input values have been sampled
4

(i.e. a delay of
where = sampling period), ie:
64


o 
: 2 [ ` Ga2BT>
7=\04T>
{Gze =V060T>
uGg4 H=V04T>
{Gk2B fGg2BT>
{Gj_ W
r

H 
T>
Gvw
It is of importance to note that the equation o
represents
s

a discrete convolution of the input data with the filter coefficients; hence these
coefficients constitute the impulse response of the filter.
Proof:

T>


l

T>3c


H t

r r

T>
G?vw 

, except at
, where
. Then o
s T>3J
a
v

Qs
(all terms zero except when
). This is equal to s Q since
.
3I < o `0a A
11!1
Therefore o
;
;
etc
.
As
there
is
a
finite
number
of
s,
the
s
s
s
impulse response is finite. For this reason, non-recursive filters are also called
Finite-Impulse Response (FIR) filters.
As we will see, we may also formulate a digital filter as a recursive filter; in


is also a function of previous outputs:
which, the output o

LetT>3

r
r
P
r
P
r
>T 
{Gkvw H=
o 
p q
o 
uGjv
<R s

AR


Before we can describe methods for the design of both types of filter, we need
to review the concept of the -transform.

5.3 The -transform


The -transform is important in digital filtering because it describes the sampling
process and plays a role in the digital domain similar to that of the Laplace transform in analogue filtering.
S Q (
J

is
.
The Laplace transform of a unit impulse occurring at time

H
Considerthe
3 discrete function
c `0to be a succession
cof impulses,
111 for example
of area
occurring at
,
occurring at
, etc
. The Laplace
transform of the whole sequence would be:

%
> w;0tZw#C=?`0 S ( =^N S ( =V1!11*=^
H S Q (

The
 suffix denotes the transform of the discrete sequence, not of the continuous
.
65

(

 
:
%
A
 hZw3C=^x* S =?w# S =\111]
H S Q

Let us replace

by a new variable , and rename

N;0

as

For many functions, the infinite series can


S A be represented in closed form, in
general as the ratio of two polynomials in .

5.3.1 Examples of the z-transform


step function

 

?  


,
= 1 for
%
= 111*= S Q =V11!1
 hF= S A = S \

= 0 for

 
 h
'G

S A

by summation of a geometric progression6.


Decaying exponential

t

S & G: 
H :

S *Q (

%
%
 F= S ( S A = S ( S V
= 111*= S *Q ( S Q V
= 111
 t

 
 h
'G


S ( S A

Sinewaves

hV!"fhG:  
:\!#"p
3h\ K

  
 h
 '
 G

Q ( G


S Q (


=

A
( S
'G S ( S A


'Gke#"h S A
 h

'G|!"7h S A = S %

6
strictly valid only if K43
66

5.3.2 The Pulse Transfer Function


This is the name
for ( -transform of output)/( -transform of input).
r
<
for example of an FIR filter, be s at
O\Let
 1the
11 impulse
OVvresponse,

v>Y
,
with
to .
 s  at
Let be the -transform of this sequence: r r
Let

 

c

at

%
S =V1!11
S
 t
  <= A S A = % S \
= 111=

s
s
s
s
sq q

be an input:

%
 h
 \T>dB 7=kT>b! S A =gT>4 S =\1110=kT>
S Q =V1!11

   
The product is: r r
S !T>4 7=gT>i! S A =V1!11T>
S Q 
   t <= A S A =\111 S =V11!1

s
s
s
sq q
S Q
in which the coefficient of
is:
r
<]T>
7= A`T>
uGz! =\111 T>
uGkvw H=V111 T>
G

s
s
s
s q
^

This is nothing else than the value of the output sample at 
. Hence
 
the whole sequence is the -transform of the output, say , where
   
 
. Hence the pulse transfer function, , is the -transform of the
impulse response.
For non-recursive filters:

S
 t P r q

R < s
For recursive filters:

S  C= P r
S  
 t P r q

<R s
AR
r r
 

rS r
 h 

S
 
'G| s


67

-plane pole-zero plot


 (

;IV=
, where = sampling period. Since
Let
, we have:
 ( (

Z
m md
 ( Ve#"h="h

If
, then
and
, i.e. the equation of
a circle of unit radius (the unit circle); in the ?
-plane.

Thus, the imaginary axis in the -plane (
;
Y ) maps onto the unit circle in
the -plane and the left half of the -plane (
) onto the interior of the unit
circle.
N;0
;
must be in the left half of the -plane
We know that all the poles of

5.3.3

for a continuous filter to be stable. We can therefore state the equivalent rule for
stability in the -plane:
For stability all poles in the -plane must be inside the unit circle.

5.4 Frequency response of a digital filter


This can be obtained
by evaluating the (pulse) transfer function on the unit circle
(
K ).
( i.e.
Proof
Consider the general filter

o 
p P r

r
R <ts

T>
uGkvw

NB: A recursive type can always be expressed as an infinite sum r by dividing out:

<


: P r <1 A T>
{Gkvw

 
s
}G A S A we have o
eg., for
R < s

e#"0h=#
hV'1!11C

Let input before samplingA be BQ (@`
,S sampled
at
. Therefore
BQ (@` L
T>
:Ze#"*W
g=|#O %#E
=
KK
r5 
r5
r
r
 Pr

QeS (@x = P r
S QeS (@x

U

 <s ]
 <ts ]
ie.o
R
R
68

r r

BQ (@` P r
S ( =
S BQ (@` P r
(

 K
 K
<R s
<R s
r
r
r
r
Pr
S (  Pr
 ( S
Now <ts

t
<
s
R
R
r r
Pr
S
 
But for this filter is
<R s
r
r
Pr
S (   ` (
and so

<S s
 x ( \
Let

x .
Then
r r
Pr
( Z S

 (complex conjugate)
R <s

H : %A BQ (@`
= %A S BQ (@` S
o
K
K

x
Hence


or

o 
pV!#"
j=^'=^

when

T>
Ve#"0W
k=|#

Thus and represent the gain and phase of the frequency response. i.e. the
frequency response (as a complex quantity) is

 * m
@R We

Example
Consider the 5-point parabolic filter.


o 
: 2 [ ` Ga2BT>
7=\04T>
{Gze =V060T>
uGg4 H=V04T>
{Gk2B fGg2BT>
{Gj_ W

hence

%

 t
 
xGy2}=V0 S A =\06 S =V0 S + Gg2 SH   
2[


69

thus

%

  @R , 
` Ga2}=\0 S ( =V*6 S ( =V0 S + ( Gk2 HS ( 
2[





 S % (
 ( O
 
`06'=?B_he#"7hGjhe#"p0ha
2[


m506=?4_te#"h^GkO!#"p0hm
m  ( *mB
2[
Therefore

hzY7m  ( 0mB
When
m  ( *mBY 156K 36
h)1_3B
Y15B_
and K
when
, i.e.
 K ( tFGI0h
N
i.e. linear phase (true
4 for any FIR filter with palindromic coefficients); all frequencies delayed by
(as expected!)

70

Das könnte Ihnen auch gefallen