lfiltering lec5
TRANSCRIPT
-
8/12/2019 lFILTERING Lec5
1/21
M.H. Perrott 2007 Filtering in Continuous and Discrete Time, Slide 1
Filtering inContinuous andDiscrete Time
Lowpass, highpass, bandpass filtering Filter response to cosine wave inputs Discrete-Time Fourier Transform Filtering based on difference equations
Copyright 2007 by M.H. PerrottAll rights reserved.
-
8/12/2019 lFILTERING Lec5
2/21
M.H. Perrott 2007 Filtering in Continuous and Discrete Time, Slide 2
0
X(f)
Voiceband
frequencies
f
RF transmission
frequencies
0
Y(f)
Voiceband
frequencies
f
RF reception
frequencies
RF
Transmitter
Voice
RF
Transmission
RF
Receiver
Voice
RF
Reception
Interferer
Motivation for Filtering
Filtering is used to remove undesired signalsoutside of the frequency band of interest Enables selection of a specific radio, TV, WLAN, cell
phone, cable TV channel Undesired channels are often called interferers
-
8/12/2019 lFILTERING Lec5
3/21
M.H. Perrott 2007 Filtering in Continuous and Discrete Time, Slide 3
1
0 ffo
R(f)
-fo 2fo-2fo
2A
0f
fo
W(f)
-fo
A A
2fo-2fo
2A
0f
fo
H(f)
-fo 2fo-2fo
Lowpass Filter
Only low frequency(i.e. baseband)portion remains
y(t) = 2cos(2fot)
z(t) r(t)
LowpassFilter
w(t)H(f)
-
8/12/2019 lFILTERING Lec5
4/21M.H. Perrott 2007 Filtering in Continuous and Discrete Time, Slide 4
1
0 ffo
R(f)
-fo 2fo-2fo
0f
fo
W(f)
-fo
A A
2fo-2fo
2A
0f
fo
H(f)
-fo 2fo-2fo
A A
1
Highpass Filter
Only high frequency(i.e. RF) portionremains
y(t) = 2cos(2fot)
z(t) r(t)
HighpassFilter
w(t)H(f)
-
8/12/2019 lFILTERING Lec5
5/21M.H. Perrott 2007 Filtering in Continuous and Discrete Time, Slide 5
1
0 ffo
R(f)
-fo 2fo-2fo
0f
fo
W(f)
-fo
A A
2fo-2fo
2A
0f
fo
H(f)
-fo 2fo-2fo
A A
1
Bandpass Filter
Only high frequency(i.e. RF) portionremains
y(t) = 2cos(2fot)
z(t) r(t)
BandpassFilter
w(t)H(f)
-
8/12/2019 lFILTERING Lec5
6/21M.H. Perrott 2007 Filtering in Continuous and Discrete Time, Slide 6
1
0 ffo
R(f)
-fo 2fo-2fo
0f
fo
W(f)
-fo
A A
2fo-2fo
2A
0f
fo
H(f)
-fo 2fo-2fo
A A
1
Interferer
Only desiredRFportion remains Interferer eliminated
Why is Bandpass Filtering Useful? Allows removal of interfering signals
Highpass filtering would be of limited use here
Typically higher complexity implementation than withlowpass or highpass filters Many RF systems such as cell phones use specialized
components called SAW filtersto achieve bandpass filtering
-
8/12/2019 lFILTERING Lec5
7/21M.H. Perrott 2007 Filtering in Continuous and Discrete Time, Slide 7
ffc
K
-fc
K2
1
0ffc
K
-fc 0
Ideal Lowpass Practical Lowpass
H(f)
H(f)
ffc-fc
H(f)
fc
-fc
H(f)
A More Formal Treatment of Filters
An ideal filter would have a brickwall magnitude
response and zero phase response Practical filters have a more gradual magnitude rolloffand a non-zero phase response
Design of the filter usually focuses on getting a
reasonable magnitude rolloff with a specifiedcutoff frequency fc (i.e., filter bandwidth)
-
8/12/2019 lFILTERING Lec5
8/21M.H. Perrott 2007 Filtering in Continuous and Discrete Time, Slide 8
ffo
K
-fo 0
H(f)
f
H(f)
0
1
ffo
X(f)
1
-fo
fo-fo
Lowpass Filter: H(f)
0 ffo
Y(f)
-fo
H(fo)H(fo)
ej
H(-fo)H(-fo)
ej
Response of Filter to Input Cosine
Fourier transform analysis:
Key properties of practical filters Magnitude response is even:
Phase response is odd:
Well explain why this is true in 6.003
-
8/12/2019 lFILTERING Lec5
9/21
M.H. Perrott 2007 Filtering in Continuous and Discrete Time, Slide 9
Compute Fourier Transform
Fourier transform of output:
Define:
ffo
K
-fo 0
H(f)
f
H(f)
0
1
ffo
X(f)
1
-fo
fo-fo
Lowpass Filter: H(f)
0 ffo
Y(f)
-fo
H(fo)H(fo)
ej
H(-fo)H(-fo)
ej
-
8/12/2019 lFILTERING Lec5
10/21
M.H. Perrott 2007 Filtering in Continuous and Discrete Time, Slide 10
Compute Time-Domain Response
Transform back to time domain:
ffo
K
-fo 0
H(f)
f
H(f)
0
1
ffo
X(f)
1
-fo
fo-fo
Lowpass Filter: H(f)
0 ffo
Y(f)
-fo
H(fo)H(fo)
ej
H(-fo)H(-fo)
ej
-
8/12/2019 lFILTERING Lec5
11/21
M.H. Perrott 2007 Filtering in Continuous and Discrete Time, Slide 11
ffo
K
-fo 0
H(f)
f
H(f)
0
1
ffo
X(f)
1
-fo
fo-fo
Lowpass Filter: H(f)
0 ffo
Y(f)
-fo
H(fo)H(fo)
ej
H(-fo)H(-fo)
ej
Key Observations of Filter Response
Input cosine wave is scaledin amplitude and
phase-shiftedin time Scale factor set by magnitude of H(f)at f=fo Phase shift set by phase of H(f)at f=fo
We typically focus only on the magnitudeof thefrequency response, H(f), of the filter
-
8/12/2019 lFILTERING Lec5
12/21
M.H. Perrott 2007 Filtering in Continuous and Discrete Time, Slide 12
Designing and Using Filters Within Matlab
Our lab exercises will have you design and use
filters in Matlab Matlab will interface to the USRP board in order toreceive real world signals from the antenna
Matlab framework is based on discrete-timesequences(which are indexed on integer values) Correspond to samplesof corresponding real world signals
(which are continuous-timein nature)
n
x[n]
1
x(t)
t
Real World Matlab
We need another Fourier analysis tool
-
8/12/2019 lFILTERING Lec5
13/21
M.H. Perrott 2007 Filtering in Continuous and Discrete Time, Slide 13
The Discrete-Time Fourier Transform
Allows us to deal with non-periodic, discrete-timesignals
Frequency domain signal isperiodicin this case
Where:
n
x[n]
1
0
X(ej2)
1-1
Note: fftfunction in Matlab used to compute DTFT
-
8/12/2019 lFILTERING Lec5
14/21
M.H. Perrott 2007 Filtering in Continuous and Discrete Time, Slide 14
n
x[n]
1
0
X(ej2)
1-1
t
x(t)
T
0f
X(f)
1/T-1/T
Matlab Sequence Samples of Real World Signal
Relating to Samples of `Real World Signals
Samples of a continuous-time signal with sampleperiod Tleads to frequency domain signal withperiod 1/T
We simply scale frequency axis of fftin Matlab We will say much more about samplinglater
-
8/12/2019 lFILTERING Lec5
15/21
M.H. Perrott 2007 Filtering in Continuous and Discrete Time, Slide 15
Filters Within Matlab
Implemented as difference equations Current output, y[n], depends on weighted values of
previous output samples and current and previous input
samples, x[n]
Group aand bcoefficients as vectors:
Execute filter using the filtercommand:
Discrete-Time
Filterx[n]H(ej2)
n
x[n]
1
y[n]
n
1
y[n]
-
8/12/2019 lFILTERING Lec5
16/21
M.H. Perrott 2007 Filtering in Continuous and Discrete Time, Slide 16
Impact of Delay on DTFT
Consider a signal that is a delayed version ofanother signal:
Compute DTFT of y[n]
-
8/12/2019 lFILTERING Lec5
17/21
M.H. Perrott 2007 Filtering in Continuous and Discrete Time, Slide 17
Compute Filter Response using DTFT
Make use of the time shift property:
Filter response is simply ratio of output over input:
F F l
-
8/12/2019 lFILTERING Lec5
18/21
M.H. Perrott 2007 Filtering in Continuous and Discrete Time, Slide 18
FIR Filters
Finite Impulse Response (FIR) filters use only bcoefficients in their implementation
Example:
x[n]H(ej2)
y[n]
k
bk
Nk
ak
M1
1
0
Note:
Fil O d f FIR Fil
-
8/12/2019 lFILTERING Lec5
19/21
M.H. Perrott 2007 Filtering in Continuous and Discrete Time, Slide 19
Filter Order for FIR Filters
Consider two different values for N
Higher Nleads to steeper filter response We refer to Nas the orderof the filter
H(ej2)
0 1-1
8
H(ej2)
0 1-1
4
N=3 N=7
x[n]
H(e
j2
)
y[n]
k
bk
Nk
ak
M1
1
0
FIR Filt D i i M tl b
-
8/12/2019 lFILTERING Lec5
20/21
M.H. Perrott 2007 Filtering in Continuous and Discrete Time, Slide 20
FIR Filter Design in Matlab
Lowpass, highpass, and bandpass filters can berealized by appropriately scaling the relative valueof the bcoefficients Higher order (i.e., higher N) leads to steeper responses
Perform FIR filter design using fir1command
Frequency response observed with freqzcommand
x[n]
H(ej2
)
y[n]
k
bk
Nk
ak
M1
K
0
See Prelab portion of Lab 3 for details
S
-
8/12/2019 lFILTERING Lec5
21/21
M.H. Perrott 2007 Filtering in Continuous and Discrete Time, Slide 21
Summary Filters can generally be classified according to
Lowpass, highpass, bandpass operation
Bandwidth and order of filter
Given a cosine input to a filter, output is: Scaled in amplitude by magnitude of filter frequency response
Shifted in phase by phase of filter frequency response
Matlab operates on discrete-time signals Use DTFT for analytical analysis
Use commands such as fir1, freqz, and filterfor design andimplementation of FIR filters
Next lecture: introduce I/Q modulation and furtherdiscuss continuous-time filtering