Lecture 5 - Digital Filters

Lecture 5 - Digital Filters

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 multiplica- tion 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 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 tech- niques and hence digital filters can meet very tight specifications on magnitude and phase characteristics (which would be almost impossi- ble 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 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. 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 ¡£¢¥¤§¦! #"¢$ %'& ¦ ¡£¢¥¤§¦)! #"*¢,+-$%.& ¦ ( Consider ( (one cycle every 4 samples) and also (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 ensure that any frequency above 0/#0 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, 1 23/4 Hz at the 156#/4 output could have been produced either by 152#/4 Hz or Hz at the input. With the anti-aliasing filter, any signal at 7186#/0 Hz will be suppressed prior to 1 23/4 A/D conversion, i.e. 1 23/4 coming out must represent going in. Since we cannot build perfect anti-aliasing filters, however, digital filters will normally have their passband well below 0/4 Hz. 5.1.3 Reconstruction of output waveform The data at the output of the D/A converter must be interpolated in order to re- construct the filtered signal. Usually this takes the form of step or one-point inter- polation (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 1 0.5 0 −0.5 −1 0 10 20 30 40 50 60 70 80 90 100 1 0.5 0 −0.5 −1 0 10 20 30 40 50 60 70 80 90 100 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 % % ¨ :);<>=? @;BAC=? ; 9 ¨ DFEHGI GJK#K L where 9 = value of parabola at each of the 5 possible values of % and ;<*;BAK; 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 1 2 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: % % % P % % ¢N;<K;A,K; ¦O ¢¥T>¨ UGV¨;<>=? @;BAC=? ; W¦ M % QKR:S Minimizing the least-squares error gives: X X X M M M Y7 Z7 Y % X X X ;BA ; ;< and and thus: % QKR P % T>¨ ;<©=\*3; [ % QKR:S % Q]R P *3;BA£ T>¨ % QKR:S 62 parabolic fit -2 -1 0 1 2 centre point, k=0 Figure 5.4: Parabolic fit. % QKR % P % *3;<>=^2B_H; T>¨ H % Q]R:S which therefore gives: ¢`Ga24T>¨bGa4 =V00T>¨bGc! =\064T>¨dB =V*4T>¨be fGg2BT>¨4 ¥¦ ;< 2 [ ;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: % % ¨ Om <KY;*<>=^ @;BAn=^ ; m <Z;*< 9 QKR QKR Thus, the parabola coefficient ;< given above is the output sequence number calculated from a set of 5 input sequences points. The output sequence so ob- tained 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 magni- tude 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 dig- ital filter, which are defined by the following relationship (known as a difference 63 1.5 1 0.5 0 −0.5 0 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 0.8 0.6 f / 2 samp |H(z)| 0.4 0.2 0 0 100 200 300 400 500 600 700 f Figure 5.6: Frequency response of 5-point parabolic filter. equation): r P r ¨ p q T>¨ uGkvw o <ts R r where the coefficients determine the filter characteristics. The difference equa- s tion for the 5-point smoothing filter, therefore, is: ¨ p ¢xGy2BT>¨ J=^4 =\04T>¨ c=\! =\064T>¨ 7=V00T>¨ uGz! fGj2BT>¨ {G|4 W¦ o 2 [ ¨ This is a non-causal filter since a given output value o depends not only on T>¨ }=k! previous inputs, but also on the current input T>¨ , the input and the 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 (i.e. a delay of 4 where = sampling period), ie: 64 ¨ : ¢`Ga2BT>¨ 7=\04T>¨ {Gze =V060T>¨ uGg4 H=V04T>¨ {Gk2B fGg2BT>¨ {Gj_ W¦ o 2 [ 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: r r T>¨ l T>¢ 3¦c ¨ H t T>¨ G?vw Let , except at , where . Then o s T>¢ 3¦ va T>¢ 3¦J Q Q (all terms zero except when ). This is equal to since . s s ¢ 3¦I < ¢`0¦a A 11!1 o 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 ¨ which, the output o is also a function of previous outputs: r r P r P r ¨ p T>¨ {Gkvw H= ¨ uGjv q o o <s A£ R R 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 trans- form in analogue filtering. S Q ( ¤J The Laplace transform of a unit impulse occurring at time is . Consider the discrete function ¡£¨ H to be a succession of impulses, for example ¤c ¡£¢`0¦ ¤c 111 of area ¡£¢ 3¦ occurring at , occurring at , etc . The Laplace transform of the whole sequence would be: % S S S Q ( ( ( ¢w;0¦tZ¡£¢w#¦C=?¡£¢`0¦ =^¡£¢N¦ =V1!11*=^¡£¨ H > The suffix denotes the transform of the discrete sequence, not of the continuous ¡£¢¥¤§¦ .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    12 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us