Digital Filters Slides 28.5.2020

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

DIGITAL FILTERS

• In signal processing, the function of a filter is to remove or keep certain


parts of a signal.
• There are broadly two types of filters ,analog or digital. An analog filters
use analog electronic circuits to produce the required filtering effect.
• A digital filter uses a digital processor to perform numerical
calculations on sampled values of the signal

6/3/2020 FEE 521


Digital filters

The digital filtering processor may be a general-purpose


computer such as a PC, or a specialized DSP (Digital
Signal Processor).
In a digital filter, the signal is represented by a sequence
of numbers, rather than a voltage or current as in the
analogue filters

6/3/2020 FEE 521


Digital filter

6/3/2020 FEE 521


Digital filter

• The analog input signal must first be sampled and


digitized using an analog to digital converter(ADC).
• The processor carries out numerical calculations on
the binary numbers, representing successive sampled
values of the input signal
• The calculations involve multiplying the input values
by constants and adding the products

6/3/2020 FEE 521


Advantages of digital filters

• Digital filters are stable as they do not suffer from temperature


variations
• Digital filter characteristics are changed with software (
programmable) and are useful for adaptive filtering.
Analog filter’s can only be changed by redesigning the filter circuit.

• Digital filters are easily designed, tested and implemented on a


general-purpose computer.

• Easy to sharpen the roll off by increasing the number of delay


elements .

6/3/2020 FEE 521


Limitations of a digital filter

• It is expensive.
• The signal bandwidth of the input signal is limited by the
capability of ADC and DAC.
• All computations must be complete within the sample
period.
• The bandwidth of the digital filter is much lower than an
analogue filter.
• Affected by quantization noise.
• The accuracy of the digital filter depends on the word length
used to encode into binary.
• Initial design and development time for digital hardware is
more than analog filters.

6/3/2020 FEE 521


How digital filters work
Let the digital values transferred from the ADC to the processor (digital filter) be
represented by the sequence x 0 , x1 , x 2 , x 3 , ...
And the digital output of the processor be
The digital output from the processor consists of the sequence of values

y 0 , y 1 , y 2 , y 3 , ... y n

the value of yn is calculated from the values x0, x1, x2, x3, ... , xn.
filtering action of the digital filter is determined by the way the y values are calculated
from the x values( and in some cases previous y values)

6/3/2020 FEE 521


Simple digital filters (examples 1&2)

Examples of digital filters.

1. Unity gain filter:


y n= xn

Each output value yn is exactly the same as the corresponding input value xn:

that is y0 = x0, y1 = x1 ,y2 = x2……………

2. Simple gain filter:

yn = bxn

where b = constant.

This simply applies a gain factor b to each input value.

6/3/2020 FEE 521


Simple digital filters(example 3)
3. Pure delay filter

y = x
n n-1

The output value at time t = nh is simply the input


at time t = (n-1)h, i.e. the signal is delayed by time
h:

that is y 0= x-1 y 1 = x0 y 2= x1 y 3 = x2 ...

6/3/2020 FEE 521


Simple digital filters(example 4)
4. Two-term difference filter

•y n= xn - x n-1

•The output value at t = nh is equal to the difference between the


current input xn and the previous input xn-1:
•the output is the change in the input over the most recent
sampling interval h.
•Effect similar to that of an analog differentiator circuit.

6/3/2020 FEE 521


Simple digital filters(example 5)

5. Two-term average filter:


The output is the average (arithmetic mean) of the
current and previous input:
yn = ( xn + xn-1)/2

This equation tends to smooth out high-frequency


variations in a signal.
This is a type of low pass filter.

6/3/2020 FEE 521


Order of a digital filter

The order of a digital filter is the number of previous inputs used


to calculate the current output.
Examples (1) and (2) above are zero-order filters, as the current
output yn depends only on the current input xn and not on any
previous inputs.
Examples (3), (4) and (5) are all of first order, as one previous
input (xn-1) is used to calculate yn.

6/3/2020 FEE 521


Digital filter coefficients

• The digital filter examples given in earlier slides can be written in the
following forms:
y n= b0xn

y n= b0xn + b1 x n-1

y n= b0xn +b1 x n-1+ b2 x n-2

• The constants b0, b1, b2, ... are called filter coefficients.
• Values of these coefficients determine the characteristics of a particular
filter.

6/3/2020 FEE 521


Examples

What is the order of each of the following filters,


(i) y n = 3xn - xn-1
(ii) y n = 2xn-2
(iii) y n = 3xn - 2x n-1 + 4xn-2 +1 xn-3
(i) is 1st order
(i) is 2nd order
(i) is 3rd order

6/3/2020 FEE 521


Recursive vs non-recursive filters

In all the examples we have looked at so far the current output (yn) is depends only on
the current and previous input values (xn, xn-1, xn-2, ...).
These types of filter is said to be non-recursive.
This type of is also filter is known as an FIR (Finite Impulse Response) filter,
FIR refers to the impulse responses of the filter.
FIR filter is one whose impulse response is of finite duration
Remember - Impulse response of a an LTI system is the output sequence from the
system when a unit impulse is applied at its input.

6/3/2020 FEE 521


Recursive filter
A recursive filter is one which in addition to input values also uses previous output values(feed back)
A recursive filter is also referred as an IIR ( Infinite Impulse Response) filter.
The expression for a recursive filter therefore contains not only terms involving the input values (xn, xn-1,
xn-2, ...) but also yn-1, yn-2, ... terms

A simple example is the filter represented by the equation

y n= xn+ y n-1

Just like the FIR filter the order of the IIR filter is the largest number of previous and previous outputs
that are used to compute the output

6/3/2020 FEE 521


Why recursive filter?

A useful feature of recursive filters is the economy with which the output
values are calculated, as compared with the equivalent non-recursive filter.
Consider a case where determined simply by adding the current input to the
previous 8 inputs for a non-recursive filter
y9 = x9 + x8 + x7 + x6 + x5 + x4 + x3 + x2
+ x1 + x0
To achieve the same effect with a recursive would entail using the expression
y 9 = x9 + y 8

This would mean much less addition operations and also less storage

6/3/2020 FEE 521

You might also like