Digital Signal Processing with
LabVIEW 8.6
Lab # 08
Spectral Analysis using FFT (Fast Fourier
Transform)
Designed by
Adnan Niazi
Lab Engineer
Signal Processing/Signal & Systems Lab
CECOS University of IT & Emerging Sciences
10th- 11th April 2009
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Agenda
What is Fourier Transform
What is Discrete Fourier Transform
What is Fast Fourier Transform
Characteristics of FFT
Windowing
Why use Windowing
Effect of Windowing on FFT
Types of Windows
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Fourier Transform
Fourier transform is used to view the spectral contents
of an analog signal
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Discrete Fourier Transform
Fourier transform can only be used for analog signals
Discrete Fourier Transform is used for to find the
spectral composition of digital signals
where x is the input sequence, X is the DFT, and n is the
number of samples in both the discrete-time and the
discrete-frequency domain
n is also reoffered to as the window size
To calculate the discrete Fourier transform the DSP will
need to perform n2 complex operations
©2008
09 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Fast Fourier Transform (FFT)
Fast Fourier Transform performs the same function as
discrete Fourier transform
However, FFT requires only nlog2(n) operations.
Thus FFT is a much more computationally efficient
algorithm compared to DFT
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
FFT
To calculate FFT two parameter are very important
sampling rate fs
block size N
If Block size N is 512 it means that FFT is calculated
from 512 time domain samples. The FFT will generated
512 frequency domain samples.
The 0th sample will represent 0Hz and the 511th sample
will represent fs
Thus the multiplication factor for the FFT should be
fs/(N-1)
008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
FFT
If a signal is sampled at fs Hz than it means that the
highest frequency that it contains is fs/2 Hz
This implies that FFT is only significant from 0 Hz - fs/2
Hz or (0 to (N/2)-1) samples
The second relationship links the frequency resolution
(f) to the total acquisition time (T), which is related to the
sampling frequency (fs) and the block size(N) of the FFT
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
FFT (Front Panel)
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
FFT (Block Diagram)
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
The Higher the N, finer the FFT
FFT of a 10KHz signal sampled at 48Khz using a 128
point FFT
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
The Higher the N, finer the FFT
FFT of a 10KHz signal sampled at 48Khz using a 512
point FFT
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
The Higher the N, finer the FFT
FFT of a 10KHz signal sampled at 48Khz using a 1024
point FFT
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Windowing
For FFT to be accurate the input signal must infinite
In actual practice the DSP can only process a certain
number of samples(N) at a time. It can’t process infinite
samples all at once.
Discontinuities are seen by the DSP processors which
results in spectral widening
This is known as Spectral Leakage
The cure for this problem is Windowing
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Why Use Windowing
NN samples being
Next N samples
Acquired by DSP
being Acquired by
FFT being
for calculating
Calculated
DSP for
FFT
calculating FFT
A huge discontinuity
is seen by the DS
processor in the
incoming data
although original has
no discontinuity. This
result sin Spectral
Leakage
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Windowing
Windowing lessens the spectral leakage by taking the
signal to zero at the end.
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Signal after Windowing
NN samples being
Next N samples
Acquired by DSP
being Acquired by
FFT being
for calculating
Calculated
DSP for
FFT
calculating FFT
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
FFT with and without Windowing
FFT without Windowing
FFT with Windowing
Spectral
Spectral
Spectral
Spectral
Leakage is
Leakage is
Leakage
Leakage
Reduced
Reduced
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Types of Windows
Hanning Widow
Hamming Window
Blackman Window
Blackman - Harris Window
Blackman - Nuttall
Exact Blackman Window
Cosine Window
Cosine Tapered Window
Kaiser Window
Gaussian Window
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Types of Windows
Bohman Window
Rectangular Window
Exponential Window
Chebychev Window
Dolph - Chebychev Window
Parzen Window
Flat Top Window
Welch Window
Bartlett Hanning Window
©2008-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
Task 1
Design a Stereo VU Meter
Each channel must be assigned four LEDs on the DSP kit
The front panel must have Digital and Analog VU Meter
for both audio channels
The audio output to the headphones must be stereo as
well
The Digital VU meter on the Front Panel must be lying
horizontal
Attenuation of the incoming Audio Signals must be
controlled from a single slider
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Task 1: Stereo VU Meter
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Task 2
Play the Spartan3E-launch.wmv Video and observe the
stereo VU meter and decide whether the audio is mono
or Stereo.
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Task 3
Play the Brain operated Keyboard from gTEC
Austria.wmv and observe the stereo VU meter and
decide whether the audio is mono or Stereo.
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Task 4
Play the zelprint.wmv and observe the stereo VU meter
and decide whether the audio is mono or Stereo.
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Lab Report 5
The lab Report must contain
A picture of the front panel
A picture of the block diagram
A precise one line answer to Task 2
A precise one line answer to Task 3
A precise one line answer to Task 4
Always Write Full Question before beginning to answer it
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences
Electronic Paint Brush
©2008-2009 All rights reserved.
Contact: [email protected]
CECOS University of IT & Emerging Sciences