Sie sind auf Seite 1von 10

In signal processing, the function of a filter is to remove unwanted parts of the signal, such as random noise, or to

extract useful parts of the signal, such as the components lying within a certain frequency range.
Figure 1: A block diagram of a basic filter
There are two main kinds of filter, analog and digital. They are quite different in their physical makeup and in how they
work.
An analog filter uses analog electronic circuits made up from components such as resistors, capacitors and op amps
to produce the required filtering effect. Such filter circuits are widely used in such applications as noise reduction,
video signal enhancement, graphic equalisers in hifi systems, and many other areas.
There are wellestablished standard techniques for designing an analog filter circuit for a given requirement. At all
stages, the signal being filtered is an electrical voltage or current which is the direct analog of the physical quantity
!for example, a sound or video signal or transducer output" involved.
A digital filter uses a digital processor to perform numerical calculations on sampled values of the signal. The
processor may be a generalpurpose computer such as a #$, or a speciali%ed &S# !&igital Signal #rocessor" chip.
The analog input signal must first be sampled and digiti%ed using an A&$ !analogtodigital converter". The resulting
binary numbers, representing successive sampled values of the input signal, are transferred to the processor, which
carries out numerical calculations on them. These calculations typically involve multiplying the input values by
constants and adding the products together. If necessary, the results of these calculations, which now represent
sampled values of the filtered signal, are output through a &A$ !digitaltoanalog converter" to convert the signal back
to analog form.
'ote that in a digital filter, the signal is represented by a sequence of numbers, rather than a voltage or current.
Figure 2: A block diagram of a basic digital filter
Advantages of &igital (ilters
The following list gives some of the main advantages of digital over analog filters)
*. A digital filter is programmable, in other words, its operation is determined by a program stored in the
processor+s memory. This means the digital filter can easily be changed without affecting the circuitry
!hardware". An analog filter can only be changed by redesigning the filter circuit.
,. &igital filters are easily designed, tested and implemented on a generalpurpose computer or workstation.
-. The characteristics of analog filter circuits !particularly those containing active components" are sub.ect to
drift and are dependent on temperature. &igital filters do not suffer from these problems, and so are
extremely stable with respect both to time and temperature.
/. 0nlike their analog counterparts, digital filters can handle low frequency signals accurately. As the speed of
&S# technology continues to increase, digital filters are being applied to high frequency signals in the 1(
!radio frequency" domain which, in the past, was the exclusive preserve of analog technology.
2. &igital filters are very much more versatile in their ability to process signals in a variety of ways. This
versatility includes the ability of some types of digital filter to adapt to changes in the characteristics of the
signal.
(ast &S# processors can handle complex combinations of filters in parallel or cascade !series", making the hardware
requirements relatively simple and compact in comparison with the equivalent analog circuitry.
3peration of &igital (ilters
In the next few sections, we will develop the basic theory of the operation of digital filters. This is essential to an
understanding of how digital filters are designed and used. (irst of all, we need to introduce a basic notation.
Suppose the 4raw4 signal that is to be digitally filtered is in the form of a voltage waveform described by the function
5 6 x !t"
where t is time.
This signal is sampled at time intervals h !the sampling interval". The sampled value at time t 6 ih is
xi 6 x !ih"
Thus the digital values transferred from the A&$ to the processor can be represented by the sequence
x7, x*, x,, x-, ...
corresponding to the values of the signal waveform at times t 6 7, h, ,h, -h, ... !where t 6 7 is the instant at which
sampling begins".
At time t 6 nh !where n is some positive integer", the values available to the processor, stored in memory, are
x7, x*, x,, x-, ... , xn
'ote that the sampled values xn8*, xn8,, and so on are not available as they haven+t happened yet9
The digital output from the processor to the &A$ consists of the sequence of values
y7, y*, y,, y-, ... , yn
In general, the value of yn is calculated from the values x7, x*, x,, x-, ... , xn. The way in which the y values are
calculated from the x values determines the filtering action of the digital filter.
:xamples of Simple &igital (ilters
The following examples illustrate the essential features of digital filters.
*. UNITY GAIN FILTER: yn 6 xn
:ach output value yn is exactly the same as the corresponding input value xn)
y7 6 x7
y* 6 x*
y, 6 x,
... etc
This is a trivial case in which the filter has no effect on the signal.
,. SIMPLE GAIN FILTER: yn 6 ;xn !; 6 constant"
This simply applies a gain factor ; to each input value)
y7 6 ;x7
y* 6 ;x*
y, 6 ;x,
... etc
; < * makes the filter an amplifier, while 7 = ; = * makes it an attenuator. ; = 7 corresponds to an inverting
amplifier. :xample * above is the special case where ; 6 *.
-. PURE DELAY FILTER: yn 6 xn*
The output value at time t 6 nh is simply the input at time t 6 !n*"h, in other words, the signal is delayed by
time h)
y7 6 x*
y* 6 x7
y, 6 x*
y- 6 x,
... etc
'ote that as sampling is assumed to commence at t 6 7, the input value x* at t 6 h is undefined. It is usual
to take this !and any other values of x prior to t 6 7" as %ero.
/. TWO-TERM DIFFERENCE FILTER: yn 6 xn xn*
The output value at t 6 nh is equal to the difference between the current input xn and the previous input xn*)
y7 6 x7 x*
y* 6 x* x7
y, 6 x, x*
y- 6 x- x,
... etc
in other words, the output is the change in the input over the most recent sampling interval h. The effect of
this filter is similar to that of an analog differentiator circuit.
2. TWO-TERM AVERAGE FILTER: yn 6 !xn 8 xn*" > ,
The output is the average !arithmetic mean" of the current and previous input)
y7 6 !x7 8 x*" > ,
y* 6 !x* 8 x7" > ,
y, 6 !x, 8 x*" > ,
y- 6 !x- 8 x," > ,
... etc
This is a simple type of lowpass filter as it tends to smooth out highfrequency variations in a signal. !?e
will look at more effective lowpass filter designs later".
@. THREE-TERM AVERAGE FILTER: yn 6 !xn 8 xn* 8 xn," > -
This is similar to the previous example, with the average being taken of the current and two previous inputs)
y7 6 !x7 8 x* 8 x," > -
y* 6 !x* 8 x7 8 x*" > -
y, 6 !x, 8 x* 8 x7" > -
y- 6 !x- 8 x, 8 x*" > -
... etc
As before, x* and x, are taken to be %ero.
A. CENTRAL DIFFERENCE FILTER: yn 6 !xn xn," > ,
This is similar in its effect to Ex!"#e $. The output is equal to half the change in the input signal over the
current value and value two time intervals prior)
y7 6 !x7 x," > ,
y* 6 !x* x*" > ,
y, 6 !x, x7" > ,
y- 6 !x- x*" > ,
... etc
3rder of a &igital (ilter
The order of a digital filter can be defined as the number of previous inputs !stored in the processor+s memory" used
to calculate the current output.
This is illustrated by the filters given as examples in the previous section.
Ex!"#e 1: %& ' x&
This is a %eroorder filter, since the current output yn depends only on the current input xn and not on any
previous inputs.
Ex!"#e 2: %& ' (x&
The order of this filter is again %ero, since no previous outputs are required to give the current output value.
Ex!"#e ): %& ' x&-1
This is a firstorder filter, as one previous input !xn*" is required to calculate yn. !'ote that this filter is classed
as firstorder because it uses one previous input, even though the current input is not used".
Ex!"#e $: %& ' x& - x&-1
This is again a firstorder filter, since one previous input value is required to give the current output.
Ex!"#e *: %& ' +x& , x&-1- . 2
The order of this filter is again equal to * since it uses .ust one previous input value.
Ex!"#e /: %& ' +x& , x&-1 , x&-2- . )
To compute the current output yn, two previous inputs !xn* and xn," are neededB this is therefore a second
order filter.
Ex!"#e 0: %& ' +x& - x&-2- . 2
The filter order is again ,, since the processor must store two previous inputs in order to compute the
current output. This is unaffected by the absence of an explicit xn* term in the filter expression.
The order of a digital filter may be any positive integer. A %eroorder filter !such as those in Ex!"#e1 1 and 2 above"
is possible, but somewhat trivial, since it does not really filter the input signal in the accepted sense.
&igital (ilter $oefficients
All of the digital filter examples given in the previous section can be written in the following general forms)
Cero order)
yn 6 a7xn
(irst order) yn 6 a7xn 8 a*xn*
Second order)
yn 6 a7xn 8 a*xn* 8
a,xn,
Similar expressions can be developed for filters of any order.
The constants a7, a*, a,, ... appearing in these expressions are called the filter coefficients. The values of these
coefficients determine the characteristics of a particular filter.
The table below gives the values of the coefficients of each of the filters given as examples in the previous section.
Ex!"#e
Or2er 3 1 2
* 7 *
, 7 ;
- * 7 *
/ * * *
2 *
*
>,
*
>,
@ ,
*
>-
*
>-
*
>-
A ,
*
>, 7
*
>,
1ecursive and 'on1ecursive (ilters
(or all the examples of digital filters discussed so far, the current output !yn" is calculated solely from the current and
previous input values !xn, xn*, xn,, ...". This type of filter is said to be non
recursive.
A recursive filter is one which in addition to input values also uses previous output
values. These, like the previous input values, are stored in the processor+s
memory.
The word recursive literally means 4running back4, and refers to the fact that
previouslycalculated output values go back into the calculation of the latest
output. The expression for a recursive filter therefore contains not only terms
involving the input values !xn, xn*, xn,, ..." but also terms in yn*, yn,, ...
(rom this explanation, it might seem as though recursive filters require more
calculations to be performed, since there are previous output terms in the filter
expression as well as input terms. In fact, the reverse is usually the case. To
achieve a given frequency response characteristic using a recursive filter
generally requires a much lower order filter, and therefore fewer terms to be
evaluated by the processor, than the equivalent nonrecursive filter. This will be
demonstrated later.
:xample of a 1ecursive (ilter
A simple example of a recursive digital filter is given by
yn 6 xn 8 yn*
In other words, this filter determines the current output !yn" by adding the current input !xn" to the previous output !yn
*".
Thus)
y7 6 x7 8 y*
y* 6 x* 8 y7
y, 6 x, 8 y*
y- 6 x- 8 y,
... etc
'ote that y* !like x*" is undefined, and is usually taken to be %ero.
Det us consider the effect of this filter in more detail. If in each of the above expressions we substitute for yn* the
value given by the previous expression, we get the following)
y7 6 x7 8 y* 6 x7
y* 6 x* 8 y7 6 x* 8 x7
y, 6 x, 8 y* 6 x, 8 x* 8 x7
y- 6 x- 8 y, 6 x- 8 x, 8 x* 8 x7
... etc
Thus we can see that yn, the output at t 6 nh, is equal to the sum of the current input xn and all the previous inputs.
This filter therefore sums or integrates the input values, and so has a similar effect to an analog integrator circuit.
N45e: FIR &2 IIR 6i#5er1
Some people prefer an alternative
terminology in which a nonrecursive
filter is known as an (I1 !or (inite
Impulse 1esponse" filter, and a
recursive filter as an II1 !or Infinite
Impulse 1esponse" filter. These terms
refer to the differing 4impulse
responses4 of the two types of filter
The impulse response of a digital filter
is the output sequence from the filter
when a unit impulse is applied at its
input. !A unit impulse is a very simple
input sequence consisting of a single
value of * at time t 6 7, followed by
%eros at all subsequent sampling
instants". An (I1 filter is one whose
impulse response is of finite duration.
An II1 filter is one whose impulse
response !theoretically" continues
forever, because the recursive
!previous output" terms feed back
energy into the filter input and keep it
going. The term II1 is not very
accurate, because the actual impulse
responses of nearly all II1 filters
reduce virtually to %ero in a finite time.
'evertheless, these two terms are
widely used.
This example demonstrates an important and useful feature of recursive filters) the economy with which the output
values are calculated, as compared with the equivalent nonrecursive filter. In this example, each output is
determined simply by adding two numbers together.
(or instance, to calculate the output at time t 6 *7h, the recursive filter uses the expression
y*7 6 x*7 8 yE
To achieve the same effect with a nonrecursive filter !in other words, without using previous output values stored in
memory" would entail using the expression
y*7 6 x*7 8 xE 8 xF 8 xA 8 x@ 8 x2 8 x/ 8 x- 8 x, 8 x* 8 x7
This would necessitate many more addition operations, as well as the storage of many more values in memory.
3rder of a 1ecursive !II1" &igital (ilter
The order of a digital filter was defined earlier as the number of previous inputs which have to be stored in order to
generate a given output. This definition is appropriate for nonrecursive !(I1" filters, which use only the current and
previous inputs to compute the current output. In the case of recursive filters, the definition can be extended as
follows)
T7e 4r2er 46 re8ur1i9e 6i#5er i1 57e #rge15 &u!:er 46 "re9i4u1 i&"u5 4r 4u5"u5 9#ue1 re;uire2 54
84!"u5e 57e 8urre&5 4u5"u5<
This definition can be regarded as being quite general) it applies both to (I1 and II1 filters.
(or example, the recursive filter discussed above, given by the expression
yn 6 xn 8 yn*
is classed as being of first order, because it uses one previous output value !yn*", even though no previous inputs are
required.
In practice, recursive filters usually require the same number of previous inputs and outputs. Thus, a firstorder
recursive filter generally requires one previous input !xn*" and one previous output !yn*", while a secondorder
recursive filter makes use of two previous inputs !xn* and xn," and two previous outputs !yn* and yn,"B and so on, for
higher orders.
'ote that a recursive !II1" filter must, by definition, be of at least first orderB a %eroorder recursive filter is an
impossibility.
$oefficients of 1ecursive !II1" &igital (ilters
(rom the above discussion, we can see that a recursive filter is basically like a nonrecursive filter, with the addition of
extra terms involving previous outputs !yn*, yn,, and so on".
A firstorder recursive filter can be written in the general form
yn 6 !a7xn 8 a*xn* b*yn*" > b7
'ote the minus sign in front of the 4recursive4 term b*yn*, and the factor !*>b7" applied to all the coefficients. The
reason for expressing the filter in this way is that it allows us to rewrite the expression in the following symmetrical
form)
b7yn 8 b*yn* 6 a7xn 8 a*xn*
In the case of a secondorder filter, the general form is
yn 6 !a7xn 8 a*xn* 8 a,xn, b*yn* b,yn," > b7
An alternative 4symmetrical4 form of this expression is
b7yn 8 b*yn* 8 b,yn, 6 a7xn 8 a*xn* 8 a,xn,
'ote the convention that the coefficients of the inputs !the x+s" are denoted by a+s, while the coefficients of the outputs
!the y+s" are denoted by b+s.
The Transfer (unction of a &igital (ilter
In the last section, we used two different ways of expressing the action of a digital filter) a form giving the output yn
directly, and a 4symmetrical4 form with all the output terms !y+s" on one side and all the input terms !x+s" on the other.
In this section, we introduce what is called the transfer function of a digital filter. This is obtained from the symmetrical
form of the filter expression, and it allows us to describe a filter by means of a convenient, compact expression. The
transfer function of a filter can be used to determine many of the characteristics of the filter, such as its frequency
response.
T7e U&i5 De#% O"er54r
(irst of all, we must introduce the unit delay operator, denoted by the symbol
%
*
?hen applied to a sequence of digital values, this operator gives the previous value in the sequence. Therefore, it
introduces a delay of one sampling interval.
Applying the operator %
*
to an input value !say xn" gives the previous input !xn*")
%
*
xn 6 xn*
Suppose we have an input sequence
x7 6 2
x* 6 ,
x, 6 7
x- 6 A
x/ 6 *7
Then
%
*
x* 6 x7 6 2
%
*
x, 6 x* 6 ,
%
*
x- 6 x, 6 7
and so on. 'ote that %
*
x7 would be x* which is unknown !and usually taken to be %ero, as we have already seen".
Similarly, applying the %
*
operator to an output gives the previous output)
%
*
yn 6 yn*
Applying the delay operator %
*
twice produces a delay of two sampling intervals)
%
*
!%
*
xn" 6 %
*
xn* 6 xn,
?e adopt the !fairly logical" convention
%
*
%
*
6 %
,
in other words, the operator %
,
represents a delay of two sampling intervals)
%
,
xn 6 xn,
This notation can be extended to delays of three or more sampling intervals, the appropriate power of %
*
being used.
Det us now use this notation in the description of a recursive digital filter. $onsider, for example, a general second
order filter, given in its symmetrical form by the expression
b7yn 8 b*yn* 8 b,yn, 6 a7xn 8 a*xn* 8 a,xn,
?e will make use of the following identities)
yn* 6 %
*
yn
yn, 6 %
,
yn
xn* 6 %
*
xn
xn, 6 %
,
xn
Substituting these expressions into the digital filter gives
!b7 8 b*%
*
8 b,%
,
" yn 6 !a7 8 a*%
*
8 a,%
,
" xn
1earranging this to give a direct relationship between the output and input for the filter, we get
yn > xn 6 !a7 8 a*%
*
8 a,%
,
" > !b7 8 b*%
*
8 b,%
,
"
This is the general form of the transfer function for a secondorder recursive !II1" filter.
(or a firstorder filter, the terms in %
,
are omitted. (or filters of order higher than ,, further terms involving higher
powers of %
*
are added to both the numerator and denominator of the transfer function.
A nonrecursive !(I1" filter has a simpler transfer function which does not contain any denominator terms. The
coefficient b7 is regarded as being equal to *, and all the other b coefficients are %ero. The transfer function of a
secondorder (I1 filter can therefore be expressed in the general form
yn > xn 6 a7 8 a*%
*
8 a,%
,
Tr&16er Fu&85i4& Ex!"#e1
*. The threeterm average filter, defined by the expression
yn 6
*
>- !xn 8 xn* 8 xn,"
can be written using the %
*
operator notation as
yn 6
*
>- !xn 8 %
*
xn 8 %
,
xn"
6
*
>- !* 8 %
*
8 %
,
" xn
The transfer function for the filter is therefore
yn > xn 6
*
>- !* 8 %
*
8 %
,
"
,. The general form of the transfer function for a firstorder recursive filter can be written
yn > xn 6 !a7 8 a*%
*
" > !b7 8 b*%
*
"
$onsider, for example, the simple firstorder recursive filter
yn 6 xn 8 yn*
which we discussed earlier. To derive the transfer function for this filter, we rewrite the filter expression using
the %
*
operator)
!* %
*
" yn 6 xn
1earranging gives the filter transfer function as
yn > xn 6 * > !* %
*
"
-. As a further example, consider the secondorder II1 filter
yn 6 xn 8 ,xn* 8 xn, ,yn* 8 yn,
$ollecting output terms on the left and input terms on the right to give the 4symmetrical4 form of the filter
expression, we get
yn 8 ,yn* yn, 6 xn 8 ,xn* 8 xn,
:xpressing this in terms of the %
*
operator gives
!* 8 ,%
*
%
,
" yn 6 !* 8 ,%
*
8 %
,
" xn
and so the transfer function is
yn > xn 6 !* 8 ,%
*
8 %
,
" > !* 8 ,%
*
%
,
"

Das könnte Ihnen auch gefallen