8/8/2019 25.108_Digital Filter Design Using FDATool
1/23
c 2008 Dr. Jay Weitzen 1
Introduction to Time andFrequency:
Using Digital Filters25.108 Introduction to Engineering
IIDr. Jay Weitzen
8/8/2019 25.108_Digital Filter Design Using FDATool
2/23
c 2008 Dr. Jay Weitzen 2
Experiment Objectives:
Introduce concepts of time and frequency
Build complicated waveforms fromharmonics
Introduce concepts of digital filtering Reduce complicated waveform to simple
sinusoid
8/8/2019 25.108_Digital Filter Design Using FDATool
3/23
c 2008 Dr. Jay Weitzen 3
Basic Theory
In the early 1800s Fourier showed that
any periodic waveform could be expressedas an infinite sum of sines and cosines.
He developed a mathematical relationshipbetween a waveform in the time domain andits component sines and cosines called the
Fourier Series and The Fourier Transform
8/8/2019 25.108_Digital Filter Design Using FDATool
4/23
c 2008 Dr. Jay Weitzen 4
Time Frequency Plane
8/8/2019 25.108_Digital Filter Design Using FDATool
5/23
c 2008 Dr. Jay Weitzen 5
Wave Generation from
Components
8/8/2019 25.108_Digital Filter Design Using FDATool
6/23
c 2008 Dr. Jay Weitzen 6
Example: Waveforms and
Spectrum
A simple sinusoid in
time and frequency
8/8/2019 25.108_Digital Filter Design Using FDATool
7/23
c 2008 Dr. Jay Weitzen 7
Example: Spectrum of a Triangle
Wave
8/8/2019 25.108_Digital Filter Design Using FDATool
8/23
c 2008 Dr. Jay Weitzen 8
Basic Theory (You will learn this in 16.362
so do not worry now)
8/8/2019 25.108_Digital Filter Design Using FDATool
9/23
c 2008 Dr. Jay Weitzen 9
What is a Digital Spectrum
Analyzer
8/8/2019 25.108_Digital Filter Design Using FDATool
10/23
c 2008 Dr. Jay Weitzen 10
An Example
8/8/2019 25.108_Digital Filter Design Using FDATool
11/23
c 2008 Dr. Jay Weitzen 11
Try it Yourself
0 0 .1 0 .2 0 .3 0 .4 0 .5 0 .6 0 .7 0 .8 0 .9 1-1
-0.8
-0.6
-0.4
-0.2
0
0 .2
0 .4
0 .6
0 .8
1
Time (sec)
- 4 0 - 2 0 0 2 0 4 0 6 0
- 2 5 0
- 2 0 0
- 1 5 0
- 1 0 0
- 5 0
0
F r e q u e n c y ( H z )
Power
>> time=0:0.001:5;>> sin5=cos(time.*2*pi*5);>> plot(time,sin5)>> plot(time(1:1000),sin5(1:1000))>> SpectrumAnalyzer(sin5,1000)>>
8/8/2019 25.108_Digital Filter Design Using FDATool
12/23
c 2008 Dr. Jay Weitzen 12
Square Wave has infinite
bandwidth
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
>> sq5=sign(sin5);
>> plot(time(1:1000),sq5(1:1000))>> SpectrumAnalyzer(sq5,1000)
-500 -400 -300 -200 -100 0 100 200 300 400 500-80
-70
-60
-50
-40
-30
-20
-10
0
10
Frequency (Hz)
Power
8/8/2019 25.108_Digital Filter Design Using FDATool
13/23
c 2008 Dr. Jay Weitzen 13
What is a Filter?
Passes a band of frequencies and rejects
other frequencies Three Bands of Interest
Pass band, The frequencies which get through
Stop band, the frequencies which dont get through
Transition bands, the bands in which part of thefrequencies get through, between stop and passbands
8/8/2019 25.108_Digital Filter Design Using FDATool
14/23
c 2008 Dr. Jay Weitzen 14
Tuning a Radio, an example of
Filtering
What does it do? Passes the frequencies you want and rejects those thatyou do not want.
8/8/2019 25.108_Digital Filter Design Using FDATool
15/23
c 2008 Dr. Jay Weitzen 15
Types of Digital Filters
Low Pass: Passes low frequencies, rejects
high frequencies High Pass: Passes high frequencies,
rejects low frequencies Band Pass: Passes a band of frequencies
Band Stop: Rejects a band of frequencies
8/8/2019 25.108_Digital Filter Design Using FDATool
16/23
c 2008 Dr. Jay Weitzen 16
Filter Implementations
Infinite Impulse Response (IIR)
Feedback filter Finite Impulse response
Feed Forward Hybrid IIR/FIR
8/8/2019 25.108_Digital Filter Design Using FDATool
17/23
c 2008 Dr. Jay Weitzen 17
Key parameters in filter design
Sampling rate
Number of Taps Pass band
Stop Band
8/8/2019 25.108_Digital Filter Design Using FDATool
18/23
c 2008 Dr. Jay Weitzen 18
Using FDA tool
Type FDATOOL at
command prompt
FilterType
Dont touch this
Passband
StopBand
Sampling
Frequency
ComputeFilter Button
8/8/2019 25.108_Digital Filter Design Using FDATool
19/23
c 2008 Dr. Jay Weitzen 19
Step 2: Enter Parameters
Enter Sampling Frequency
Pass Band Stop Band
Leave Everything else the same
8/8/2019 25.108_Digital Filter Design Using FDATool
20/23
c 2008 Dr. Jay Weitzen 20
Step 3: Design Filter
Push design Filter
ButtonFilter Response Shown
8/8/2019 25.108_Digital Filter Design Using FDATool
21/23
c 2008 Dr. Jay Weitzen 21
Step 4: Export Coefficients
On File Menu Type
Export
Create Num, and Den. If you have matlab 6.5, type Den=1
S f
8/8/2019 25.108_Digital Filter Design Using FDATool
22/23
c 2008 Dr. Jay Weitzen 22
Step 5: do the filtering
Type
>> Output=filter(Num,Den,Input) to apply
the filter you have created. It is simple asthat.
8/8/2019 25.108_Digital Filter Design Using FDATool
23/23
c 2008 Dr. Jay Weitzen 23
Quick Question?
If you take a triangle wave with spectrum shown
and low pass filter remove all frequencies exceptthe fundamental, what will you see?
Answer: A sine wave at the fundamental frequency