Digital Signal Processing with
LabVIEW 8.6
Lab # 09 and 10
Digital filtering using Digital Signal
Processing
Designed by
Adnan Niazi
Lab Engineer
Signal Processing/Signal & Systems Lab
CECOS University of IT & Emerging Sciences
10th- 11thApril 2009
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Agenda
Introduction to filtering
Analog Filtering
Digital Filtering
What is FIR filter
What is IIR Filter
Types of FIR and IIR filters
What is group delay and why its important
008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Filtering
Filtering removes unwanted signals from the wanted
ones
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Types of Filtering
Analog Filtering
Digital Filtering
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Analog Filtering
Analog filters work on signals in continuous time
domain
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Types of Analog Filters
Analog filters are of three types:
Passive Filters
• Made from Resistors, Capacitors and Inductors
Active Filters
• Made from Opamps, Resistors and Capacitors
Switched Capacitor Filters
• Made from Switched capacitors
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Analog Filter Topologies
Butterworth Filter
Bessel Filter
Besselworth Filter
Chebychev Filter
Inverse Chebychev Filter
Elliptic and Cauer Filter
Gaussian 6dB Filter
Gaussian 12dB Filter
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Why Digital filters better than Analog Filtering
Analog filters become unstable when the order is
increased beyond 10
This means that you can’t make filters with very steep
roll offs
Digital filters are more accurate where as analog filters
are susceptible to variation in their response due to drift
and tolerance in component values
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Digital Filter
Digital filters work on
samples in discrete time
domain
Digital filtering can be
carried out on a
DSP
FPGA
& to some extent on a
microcontroller
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Advantages of Digital Filtering
Digital filters are very accurate as there is no component
drift
Digital filters can achieve much sharper roll off that is
impossible to obtain with analog filters
FIR filters are unconditionally stable whereas an analog
filter may become unstable if designed improperly
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Some Filter Lingo
Transition Band or Skirt
The range of frequencies between Passband and
Stopband
Roll Off
Roll Off refers to transition of from Passband to Stopband.
The higher the roll off the smaller the transition band
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Types of Filter Response
There are four major types of filter responses
Low Pass filter
High Pass filter
Band Pass filter
Band stop filter
Notch filter: is a special type of band stop filter where the
stop band is very narrow
Comb Filter
Comb filter has notches at the harmonics as well
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Types of Filter Responses
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Special Filter Responses
Notch Filter
Notch filter is special type of band stop filter in which the
stop band is very narrow
Notch filters are mostly used to remove power line
interference (50-60Hz) from the signals
Comb Filter
Comb filter has notches at multiples of a frequency
Comb filter is used to filter out a frequency along with all
its harmonics
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Comb Filter applied to ECG
Time Domain plot of ECG Signal
Frequency Domain Plot of ECG
with 60Hz noise and its
Signal with 60Hz noise and its
harmonics noise
harmonics noise
Magnitude response of the
Filtered vs. ideal ECG signal
Comb Filter
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Magnitude Response Parameters
Pass band
Ripple
Stop band
ripple
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Filter Parameters
Sample rate
Specifies the sample rate of the signal on which filtering is
to be performed
Passband Edge Frequency
Specifies the corner frequency of the filter. Frequency
beyond this frequency will be filtered out. Its also referred
to as the corner frequency
Stopband Edge Frequency
Specifies the frequency after which there is no roll off
Passband Ripple
Specifies how much ripple should in the Passband
frequencies
©2008
09 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Filter Parameters
Passband Ripple
Specifies how much ripple should in the stop band
frequencies
Stop Band Attenuation
Specifies how much the Stopband frequencies should be
attenuated before stop band ripples start to appear
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Types of Digital Filters
There are two types of digital filters
FIR Filter
IIR Filter
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
FIR Filter
FIR stands for Finite Impulse Response Filters
The impulse response of FIR Filter decays after a finite
amount of time
The mathematical equation for FIR filter is
Where as represent the Feed forward Coefficient
Coefficients are also called weights
It is weights that give a filter desired properties
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Finite Impulse Response (FIR)
FIR filters are called so because their impulse response
has a finite duration.
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Types of FIR Filter
Equi-Ripple Filter
Parks - McClellan Filter
Savitzky-Golay Smoothing Filter
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
IIR Filter
IIR stands for Infinite Impulse Response
IIR filters have an impulse response that extends to
infinity
The equation for IIR Filters is
Where as represent the Feed forward Coefficient and
b’s represent the Feed Back Coefficients
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Infinite Impulse Response
IIR filters Impulse Reponses never completely dies out
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Types of IIR Filter
Butterworth Filter
Bessel Filter
Chebychev Filter
Inverse Chebychev Filter
Kaiser Window Filter
Dolph- Chebychev Filter
IIR smoothing Filter
Least Path Norm Filter
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Advantage of FIR Filter
Filters that are normally impossible to make with IIR
filters can be made with FIR filters
There is no analog counterpart for the FIR Filters
FIR filters have linear phase or constant group delay
FIR filters are unconditionally stable (BIBO) as they have
no poles in their transfer function.
Fixed point Implementation is easier to implement
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Advantages of IIR filter
IIR filters consume less memory and DSP resources
IIR filters can become unstable if designed improperly
IIR filters suffer from a phenomenon called Ringing. The
effect of a wrong input sample is present for a very long
time because of the infinite impulse response of the IIR
filter
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Disadvantage of IIR Filter
Difficult to implement on fixed point processor
IIR filters have variable group delay which result in the
signal distortion
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
What is Group delay
Group delay is the rate of change of the phase of the
filters frequency response
The frequency reposes of a filter is given by:
Group delay is a measure of the phase distortion of a
signal after it is passed through the filter
Ideally group delay must be constant
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Group delay Demo
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Linearity of the Filter
A filter is linear if it has constant group delay or Linear
Phase delay or phase response
Linearity states that all the signals passing through the
signal must suffer the same time delay
In other words higher frequencies should suffer more
delay and lower frequencies should suffer smaller
delays
If a filter has constant group delay or linear phase delay,
the passed signal suffer from minimal distortion
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Task 1
Generate a 1000Hz Embedded Sine wave of amplitude 1
sampled at 36KHz with a DC offset of 0.5
Display the time domain Signal on the front Panel
Display the spectrum of the Signal. The spectrum should
be from 0 to fs/2.
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Task 2
Design a Filter that could remove the DC offset from the
embedded signal discussed in Task 1
The filter pass band should be 100Hz
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Lab Report for Task 1
The lab Report must contain
A picture of the front panel
A picture of the block diagram
Always Write Full Question before beginning to answer it
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Lab Report for Task 2
The lab report must contain
Picture of the front panel
Picture of the block diagram
Always Write Full Question before beginning to answer it
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Final Test for Section A
Section A test will on Monday 4th of May 2009
From 9:00 AM to 9:30 AM students will attempt 30 MCQ
questions
From 9:45 AM to 10:15 AM student will perform a
practical on the PCs
The practical performance will be related to all that you
have learned in the lab.
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Final Test for Section D
Section D test will on Tuesday 5th of May 2009
From 9:00 AM to 9:30 AM students will attempt 30 MCQ
questions
From 9:45 AM to 10:15 AM student will perform a
practical on the PCs
The practical performance will be related to all that you
have learned in the lab.
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Do you Need to worry?
If you have listened to me in the class then there will be
no problem attempting the MCQs
If you have done all the lab reports yourself then there
will be no problem in practical performance
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Automated Projector Calibration
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences