0% found this document useful (0 votes)
17 views21 pages

Doc11 B14 Dspcourse Lec2

Digital filtering can be implemented through hardware or software, utilizing various components for operations like storage and multiplication. Digital filters offer advantages over analogue filters, including programmability, predictable accuracy, and higher noise immunity. The document also discusses the sampling process, aliasing, and the reconstruction of output waveforms, emphasizing the importance of the z-transform in digital filtering.

Uploaded by

Javier Giner
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)
17 views21 pages

Doc11 B14 Dspcourse Lec2

Digital filtering can be implemented through hardware or software, utilizing various components for operations like storage and multiplication. Digital filters offer advantages over analogue filters, including programmability, predictable accuracy, and higher noise immunity. The document also discusses the sampling process, aliasing, and the reconstruction of output waveforms, emphasizing the importance of the z-transform in digital filtering.

Uploaded by

Javier Giner
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
You are on page 1/ 21

Lecture 2 - Digital Filters

2.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 computer’s CPU, GPU 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.

33
2.1.1 Reasons for using a digital rather than an analogue filter

• The numerical processor can easily be (re-)programmed to implement a num-


ber 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).

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


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

34
2.1.2 The sampling process

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


tinuous function f (t) is replaced by a “discrete function” f [k], which is defined
only at t = kT , with k = 0, 1, 2. We thence only need consider the digitised
sample set f [k] and the sample interval T .

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

Figure 2.1: Aliasing.

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

Figure 2.2: Reconstruction using a DAC and 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.

p[k] = s0 + ks1 + k 2s2


where p[k] = value of parabola at each of the 5 possible values of k = {−2, −1, 0, 1, 2}
and s0, s1, s2 are the variables used to fit each of the parabolae to 5 input data
points.
We obtain a fit by finding a parabola (coefficients s0, s1 and s2 ) which best

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

Minimizing the least-squares error gives:


∂E ∂E ∂E
= 0, = 0, and =0
∂s0 ∂s1 ∂s2
and thus:
k=2
!
5s0 + 10s2 = x[k]
k=−2
k=2
!
10s1 = kx[k]
k=−2
k=2
!
10s0 + 34s2 = k 2x[k]
k=−2
which therefore gives:
1
s0 = (−3x[−2] + 12x[−1] + 17x[0] + 12x[1] − 3x[2])
35
40
1
s1 = (−2x[−2] − x[−1] + x[1] + 2x[2])
10
1
s2 = (2x[−2] − x[−1] − 2x[0] − x[1] + 2x[2])
14
The centre point of the parabola is given by:
p[k] |k=0= s0 + ks1 + k 2s2 |k=0 = s0
Thus, the parabola coefficient s0 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. 2.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. 2.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
equation):
!N
y [k] = ai x[k − i]
i=0

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).

where the ai coefficients determine the filter characteristics. The difference


equation for the 5-point smoothing filter, therefore, is:
1
y [k] = (−3x[k + 2] + 12x[k + 1] + 17x[k] + 12x[k − 1] − 3x[k − 2])
35
This is a non-causal filter since a given output value y [k] depends not only on
previous inputs, but also on the current input x[k], the input x[k + 1] and the
input x[k + 2]. The problem is solved by delaying the calculation of the output
value y [k] (the centre point of the parabola) until all the 5 input values have been
sampled (i.e. a delay of 2T where T = sampling period), ie:

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

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

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

The z -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.
The Laplace transform of a unit impulse occurring at time t = kT is e −kT s .
Consider the discrete function f [k] to be a succession of impulses, for example
of area f (0) occurring at t = 0, f (1) occurring at t = T , etc . . .. The Laplace
transform of the whole sequence would be:
Fd (s) = f (0) + f (1)e −T s + f (2)e −2T s + . . . + f [k]e −kT s
The suffix d denotes the transform of the discrete sequence, not of the contin-
uous f (t).
Let us replace e T s by a new variable z , and rename Fd (s) as F (z ):
F (z ) = f (0) + f (1)z −1 + f (2)z −2 + . . . f [k]z −k
For many functions, the infinite series can be represented in “closed form”, in
general as the ratio of two polynomials in z −1 .

45
2.3.1 Examples of the z-transform

• step function f [k] = 0 for k < 0, f [k] = 1 for k ≥ 1


F (z ) = 1 + z −1 + z −2 + . . . + z −k + . . .
1
F (z ) =
1 − z −1
by summation of a geometric progression3 .
• Decaying exponential
f (t) = e −αt −→ f [k] = e −αkT
F (z ) = 1 + e −αT z −1 + e −α2T z −2 + . . . + e −αkT z −k + . . .
1
F (z ) =
1 − e −αT z −1
• Sinewaves
e jkωT − e −jkωT
f (t) = cos ωt −→ f [k] = cos kωT =
2
1 1 1
F (z ) = ( + )
2 1 − e jωT z −1 1 − e −jωT z −1
3
strictly valid only if | z −1 |< 1

46
1 − cos ωT z −1
F (z ) =
1 − 2 cos ωT z −1 + z −2

2.3.2 The Pulse Transfer Function

This is the name for (z -transform of output)/(z -transform of input).


Let the impulse response, for example of an FIR filter, be a0 at t = 0, a1 at
t = T , . . . ai at t = iT with i = 0 to N.
Let G(z ) be the z -transform of this sequence:
G(z ) = a0 + a1z −1 + a2z −2 + . . . + ai z −i + . . . aN z −N
Let X(z ) be an input:
X(z ) = x[0] + x[1]z −1 + x[2]z −2 + . . . + x[k]z −k + . . .
The product G(z )X(z ) is:
G(z )X(z ) = (a0 + a1z −1 + . . . ai z −i + . . . aN z −N )(x[0] + x[1]z −1 + . . . x[k]z −k )
in which the coefficient of z −k is:
a0x[k] + a1x[k − 1] + . . . ai x[k − i] + . . . aN x[k − N]

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

For recursive filters:


N
! M
!
Y (z ) = ai z −i X(z ) + bi z −i Y (z )
i=0 i=1
" −i
Y (z ) ai z
G(z ) = = "
X(z ) 1 − bi z −i

48
2.3.3 z -plane pole-zero plot

Let z = e sT , where T = sampling period. Since s = σ + jω, we have:


z = e σT e jωT
If σ = 0, then | z |= 1 and z = e jωT = cos ωT + j sin ωT , i.e. the equation
of a circle of unit radius (the unit circle) in the z -plane.
Thus, the imaginary axis in the s-plane (σ = 0) maps onto the unit circle in
the z -plane and the left half of the s-plane (σ < 0) onto the interior of the unit
circle.
We know that all the poles of G(s) must be in the left half of the s-plane for
a continuous filter to be stable. We can therefore state the equivalent rule for
stability in the z -plane:

For stability all poles in the z -plane must be inside the unit circle.

49
Simple example

Stability: we require z = α to lie inside the unit circle

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

Let input before sampling be cos(ωt + θ), sampled at t = 0, T, . . . , kT . There-


fore x[k] = cos(ωkT + θ) = 12 {e j(ωkT +θ) + e −j(ωkT +θ) }
∞ ∞
1 ! j{ω[k−i]T +θ} 1 ! −j{ω[k−i]T +θ}
i.e. y [k] = ai e + ai e
2 2
i=0 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

Let G(z )z = e jωT = Ae jφ.



!
ai e jωiT = Ae −jφ (complex conjugate)
i=0

Hence y [k] = 12 e j(ωkT +θ)Ae jφ + 12 e −j(ωkT +θ) Ae −jφ

or y [k] = A cos(ωkT + θ + φ) when x[k] = cos(ωkT + θ)


Thus A and φ represent the gain and phase of the frequency response. i.e.
the frequency response (as a complex quantity) is
G(z )|z =e jωT
51
Example

Consider the 5-point parabolic filter.


1
y [k] = (−3x[k] + 12x[k − 1] + 17x[k − 2] + 12x[k − 3] − 3x[k − 4])
35
hence
1
Y (z ) = (−3 + 12z −1 + 17z −2 + 12z −3 − 3z −4 )X(z )
35
thus
1
G(z )z =e jωT = (−3 + 12e −jωT + 17e −2jωT + 12e −3jωT − 3e −4jωT )
35
jωT 1 −2jωT
G(e ) = e (17 + 24 cos ωT − 6 cos 2ωT )
35
1
Therefore |G(e jωT )| = |17 + 24 cos ωT − 6 cos 2ωT |
35
jωT
When ωT = 0, |G(e )| = 1
and |G(e jωT )| = 0.707 when ωT ≈ 0.48π, i.e. ffs = 0.24
∠G(e jωT ) = −2ωT

i.e. linear phase (true for any FIR filter with palindromic coefficients); all frequen-
cies delayed by 2T (as expected!)
52

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy