Doc11 B14 Dspcourse Lec2
Doc11 B14 Dspcourse Lec2
33
2.1.1 Reasons for using a digital rather than an analogue filter
– 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).
34
2.1.2 The sampling process
Aliasing
Consider f (t) = cos( π2 Tt ) (one cycle every 4 samples) and also f (t) = cos( 3π t
2 T)
(3 cycles every 4 samples) as shown in Fig. 2.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
ensure that any frequency above 1/2T Hz is adequately suppressed. (This LPF
is known as an “anti-aliasing” filter and is shown to the left of the A/D converter
on the block diagram of page 46). Without an anti-aliasing filter, 0.3/T Hz at
the output could have been produced either by 0.3/T Hz or 0.7/T Hz at the
input. With the anti-aliasing filter, any signal at 0.7/T Hz will be suppressed prior
to A/D conversion, i.e. 0.3/T coming out must represent 0.3/T going in. Since
we cannot build perfect anti-aliasing filters, however, digital filters will normally
have their passband well below 1/2T Hz.
35
1
0.5
−0.5
−1
0 10 20 30 40 50 60 70 80 90 100
0.5
−0.5
−1
0 10 20 30 40 50 60 70 80 90 100
36
2.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. 2.2. The output low-pass filter is sometimes known as a recovery
samples
DAC
LPF
filter.
37
2.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 2.3,
together with its sampled version:
-2 -1 0 1 2
Figure 2.3: Noisy data.
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
38
parabolic filter), as in Fig. 2.4
parabolic fit
-2 -1 0 1 2
centre point, k=0
Figure 2.4: Parabolic fit.
39
approximates the 5 data points as measured by the least-squares error E:
2
!
E(s0 , s1, s2) = (x[k] − [s0 + ks1 + k 2s2])2
k=−2
41
1.5
0.5
−0.5
0 10 20 30 40 50 60 70 80 90 100
Figure 2.5: Noisy data (thin line) and 5-point parabolic filtered (thick line).
42
1
0.8
0.6
|H(z)|
f /2
samp
0.4
0.2
0
0 100 200 300 400 500 600 700
f
1
y [k] = (−3x[k] + 12x[k − 1] + 17x[k − 2] + 12x[k − 3] − 3x[k − 4])
35
"
It is of importance to note that the equation y [k] = ai x[k − i] represents
a discrete convolution of the input data with the filter coefficients; hence these
coefficients constitute the impulse response of the filter.
Proof:
"
Let x[k] = 0, except at k = 0, where x(0) = 1. Then y [k] = i ai x[k − i] =
43
ak x(0) (all terms zero except when i = k). This is equal to ak since x(0) = 1.
Therefore y (0) = a0; y (1) = a1; etc . . .. As there is a finite number of a’s,
the 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
which, the output y [k] is also a function of previous outputs:
N
! M
!
y [k] = ai x[k − i] + bi y [k − i]
i=0 i=1
Before we can describe methods for the design of both types of filter, we need
to review the concept of the z -transform.
44
2.3 The z -transform
45
2.3.1 Examples of the z-transform
46
1 − cos ωT z −1
F (z ) =
1 − 2 cos ωT z −1 + z −2
47
This is nothing else than the value of the output sample at t = kT . Hence
the whole sequence is the z -transform of the output, say Y (z ), where Y (z ) =
G(z )X(z ). Hence the pulse transfer function, G(z ), is the z -transform of the
impulse response.
For non-recursive filters:
N
!
G(z ) = ai z −i
i=0
48
2.3.3 z -plane pole-zero plot
For stability all poles in the z -plane must be inside the unit circle.
49
Simple example
Hence
2.4 Frequency response of a digital filter
This can be obtained by evaluating the (pulse) transfer function on the unit circle
( i.e. z = e jωT ).
Proof
Consider the general filter
∞
!
y [k] = ai x[k − i]
i=0
NB: A recursive type can always be expressed as an infinite sum by dividing out:
∞
a0 !
eg., for G(z ) = , we have y [k] = a0.b1i x[k − i]
1 − b1 z −1
i=0
50
∞ ∞
1 j(ωkT +θ) ! −jωiT 1 −j(ωkT +θ) ! jωiT
= e ai e + e ai e
2 2
i=0 i=0
!∞ ∞
!
Now ai e −jωiT = ai (e jωT )−i
i=0 i=0
!∞ ∞
!
But G(z ) for this filter is ai z −i and so ai e −jωiT = G(z )z = e jωT
i=0 i−0
i.e. linear phase (true for any FIR filter with palindromic coefficients); all frequen-
cies delayed by 2T (as expected!)
52