dsp first, 2/e reading assignmentsdspfirst.gatech.edu/archives/lectures/dspfirst-l19-pp4.pdf ·...
TRANSCRIPT
![Page 1: DSP First, 2/e READING ASSIGNMENTSdspfirst.gatech.edu/archives/lectures/DSPFirst-L19-pp4.pdf · Resolution Test Closel y s p aced fre q uenc y com p onentsyp q y p How close can the](https://reader035.vdocument.in/reader035/viewer/2022071116/5ffe01be56c3ad1c94346d72/html5/thumbnails/1.jpg)
DSP First, 2/e
Lecture 19S SSpectrogram: Spectral Analysis via DFT & DTFT
READING ASSIGNMENTSREADING ASSIGNMENTS
This Lecture: Chapter 8, Sects. 8-6 & 8-7
Other Reading:Other Reading: FFT: Chapter 8, Sect. 8-8
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 3
LECTURE OBJECTIVESLECTURE OBJECTIVES
Spectrogram Spectrogram
Time Dependent Fourier Transform Time-Dependent Fourier Transform DFTs of short windowed sections
Frequency Resolution To resolve closely spaced spectrum lines Need long windows
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 4
Review & RecallReview & Recall Discrete Fourier Transform (DFT)Discrete Fourier Transform (DFT)
1
)/2(][][N
nkNjenxkX
1
)/2(][1][N
nkNjekXN
nx
DFT is frequency sampled DTFT
0
][][n
0
][][kN
q y p For finite-length signals
DFT computation is actually done via FFT FFT of zero-padded signalmore freq samples
Transform pairs & properties (DTFT & DFT)Aug 2016 © 2003-2016, JH McClellan & RW Schafer 5
Transform pairs & properties (DTFT & DFT)
![Page 2: DSP First, 2/e READING ASSIGNMENTSdspfirst.gatech.edu/archives/lectures/DSPFirst-L19-pp4.pdf · Resolution Test Closel y s p aced fre q uenc y com p onentsyp q y p How close can the](https://reader035.vdocument.in/reader035/viewer/2022071116/5ffe01be56c3ad1c94346d72/html5/thumbnails/2.jpg)
Recall: DFT and DTFTRecall: DFT and DTFT
1
)/2(][][N
knNjenxkX Discrete Fourier
11 N
0
)(][][n
jenxkXTransform (DFT)
1
0
)/2(][1][N
k
knNjekXN
nx Inverse DFT
njj enxeX ˆˆ ][)(Discrete-time Fourier Transform (DTFT)
n
2 ˆˆ ˆ)(1][ deeXnx njjInverse DTFT
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 6
0
)(2
][ deeXnx
The Transform Method (DTFT)( )
To get the output signal y[n] given the input x[n] andTo get the output signal y[n], given the input x[n], and the system defined by h[n].
][][][ nxnhny
)(][ ˆeXnx j
][][][y
][)()()()(
)(][
ˆ
ˆˆˆ
YeXeHeY
eXnx
j
jjj
Convolution becomes multiplication of DTFTs
][)( nyeY j
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 7
Convolution becomes multiplication of DTFTs
Frequency Response MethodFrequency Response Method
To get the output signal y[n] given the input x[n] is aTo get the output signal y[n], given the input x[n] is a sinusoid, and the system defined by h[n].
)ˆcos(][][ nAnhny
)(][
)cos(][][
ˆ
0
eHnh
nAnhny
j
)()( eval 0ˆˆ 0 HeHeH jj
M lti l M it d Add Ph
)ˆcos(][ 000 HnHAny
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 8
Multiply Magnitudes, Add Phases
DTFT, DFT and DFS are Tools for AnalysisTools for Analysis• DTFT applies to discrete time sequences regardless of length (as• DTFT applies to discrete time-sequences, regardless of length (as
long as x[n] is absolutely summable);• Note: sinusoids are not absolutely summable
• N-pt DFT of a finite-length sequence is equivalent to sampling the corresponding DTFT on frequency axis at N equally spaced
i t ith t l i i f tipoints, without losing any information• Zero-padding when N>L
• If the sequence is periodic, and the DFT is performed on one period, the result is a discrete Fourier Series (DFS) which is an exact representation.
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 9
![Page 3: DSP First, 2/e READING ASSIGNMENTSdspfirst.gatech.edu/archives/lectures/DSPFirst-L19-pp4.pdf · Resolution Test Closel y s p aced fre q uenc y com p onentsyp q y p How close can the](https://reader035.vdocument.in/reader035/viewer/2022071116/5ffe01be56c3ad1c94346d72/html5/thumbnails/3.jpg)
Various Situations in Signal AnalysisSignal AnalysisA Signal property does not fluctuate with timeA. Signal property does not fluctuate with time
1. Sampled signal is periodic with known period N0 – use N0-pt DFT and get the precise result (DFS)
2 Sampled signal is aperiodic or period is unknown or hard toCOMMON 2. Sampled signal is aperiodic, or period is unknown, or hard to ascertain precisely.
3. Signal characteristic is global (for the entire signal)a. Finite-Length, e.g., pulse
CASE
g , g , pb. Infinite-Length: e.g., right-sided exponential
B Sampled signal property changes with timeB. Sampled signal property changes with time1. Signal defined by math formulas over intervals2. Recorded signal, most likely with changing sinusoidal content, or
ti th t lCOMMONCASE
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 10
properties – the most general caseCASE
ExamplesExamples
A 1 P i di20,100),50cos()5.020cos(2 0 Nftt s
A.1 Periodic Sequence
100),150cos()5.020cos(2 fttA.2 Nonperiodic
Sequence
100),150cos()5.020cos(2 sftt
A.3 Global infinite-length
,....2,1),cos(3 1.0 nne n
gsequence
B.2 A general
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 11
sequence
A.3: DTFT gives globalspectrumspectrum
21)cos(3 1.0 nne n A.3 sequence from formula
,....2,1),cos(3 nne
N-pt DFT: approaching DTFTwhen N infinity
0 2
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 12
More about this later.
When Periodicity Is Not Precise A 2Precise – A.2 Periodicity is imprecise – either not known exactly or y p y
impractical to take exactly one period of data; for example:
16L
200 N Actual period of sequence
),50cos()5.020cos(2)( tttx
We take L data points for analysis; actual period is not L
20,100,5 00 Nff s
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 13
p y ; p(20 for the example).
![Page 4: DSP First, 2/e READING ASSIGNMENTSdspfirst.gatech.edu/archives/lectures/DSPFirst-L19-pp4.pdf · Resolution Test Closel y s p aced fre q uenc y com p onentsyp q y p How close can the](https://reader035.vdocument.in/reader035/viewer/2022071116/5ffe01be56c3ad1c94346d72/html5/thumbnails/4.jpg)
Imprecise Period Example (2)
16L
)50cos()5020cos(2][ nnnx 200 N
16L
1ˆ2.0102
642)5.6(
),5.0cos()5.02.0cos(2][ nnnx
2ˆ5.0642)16(
64N|][| kX
64N16N
0 6 16 48 58 63
N32N16L
|)(| jeX
0 6 16 48 58 63
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 14
Similar Example – Changing Lp g g)5.1cos()5.02.0cos(2 nn
|][| kX16L1ˆ2.0
102
642)5.6(
ˆ512)16( |][| kX
0 6 16 48 58 63 64N
25.1264
)16(
|)(| jeX
ˆ
NL 16
|)(| jeX1ˆ2.0
2ˆ5.1 8.1ˆ L 320
512ˆ
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 15
|)(| eX
2
N 5.12
ObservationsObservations When signal property stays fixed the longer the section of data When signal property stays fixed, the longer the section of data
(larger L), the sharper the frequency resolution.
The larger the number of points for the DFT N the denser the The larger the number of points for the DFT, N, the denser the frequency axis sampling.
However the resolution (or separation) of sinusoids w r t frequency However, the resolution (or separation) of sinusoids w.r.t. frequency is determined by the data length L, not by length of the N-pt DFT (with zero padding).
When signal properties change with time, there are other considerations that limit the size of L; see case B.
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 16
Case B The General CaseCase B – The General Case
DFT can also be used as a tool for finding DFT can also be used as a tool for finding the spectral composition of an arbitrary signal:signal: In general, we observe changing signal
propertiesproperties Short-time analysis framework Analyze sequence one block (frame) of data at a Analyze sequence one block (frame) of data at a
time using DFT Successive blocks of data may overlap
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 17
“SPECTROGRAM”
![Page 5: DSP First, 2/e READING ASSIGNMENTSdspfirst.gatech.edu/archives/lectures/DSPFirst-L19-pp4.pdf · Resolution Test Closel y s p aced fre q uenc y com p onentsyp q y p How close can the](https://reader035.vdocument.in/reader035/viewer/2022071116/5ffe01be56c3ad1c94346d72/html5/thumbnails/5.jpg)
FRAME = WINDOW of DATAFRAME WINDOW of DATA
FT
frame thiframe )1( thi
Example of Non-overlapped frames
frame)2( thi
Data also can be extracted from overlappedframes – overlapped characteristics provide smoother transitions from one frame to nextN
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 18
XNDenote Number of Overlapping Points as XN
A very long signalA very long signal
F i t l Four intervals Four spectrum lines
2999500)1110cos(24990)211.0cos(5
nnnn
99995000)40(49993000)8.0cos(2
2999500)111.0cos(2)/(][
1
nnnn
fnxnx s
99995000)4.0cos(21 nn
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 19
DFT of a very Long Signal (Global)(Global) Length 10,000 signal, 16384-pt DFTLength 10,000 signal, 16384 pt DFT
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 20
Windowing a Long SignalWindowing a Long Signal Long signal is time-shifted into the domain of the window, g g ,
[0,300] in this case
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 21
![Page 6: DSP First, 2/e READING ASSIGNMENTSdspfirst.gatech.edu/archives/lectures/DSPFirst-L19-pp4.pdf · Resolution Test Closel y s p aced fre q uenc y com p onentsyp q y p How close can the](https://reader035.vdocument.in/reader035/viewer/2022071116/5ffe01be56c3ad1c94346d72/html5/thumbnails/6.jpg)
Von Hann Windowin Time Domainin Time Domain
Plot of Length-20 von Hann windowg
L00
)(LengthWindow Hannvon
LnLn
nnwh 0))1/()1(2cos(
00][ 2
121
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 22
Ln0
DTFT of Hann Window: Change LengthChange Length DTFT (magnitude) of windowed sinusoid.( g )
Length-20 Hann window vs. Length-40 Hann window
crossing-Zero
L 8ˆ
WidthPeak g
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 23
Short DFTs of Windowed Sections (L=301)Sections (L=301) 301-pt Hann window. 1024-pt DFT (zero-padded)
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 24
Short DFTs of Windowed Sections (L=75)Sections (L=75) 75-pt Hann window. 1024-pt DFT (zero-padded)
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 25
![Page 7: DSP First, 2/e READING ASSIGNMENTSdspfirst.gatech.edu/archives/lectures/DSPFirst-L19-pp4.pdf · Resolution Test Closel y s p aced fre q uenc y com p onentsyp q y p How close can the](https://reader035.vdocument.in/reader035/viewer/2022071116/5ffe01be56c3ad1c94346d72/html5/thumbnails/7.jpg)
A very long signalA very long signal
F i t l Four intervals Four spectrum lines
2999500)1110cos(24990)211.0cos(5
nnnn
99995000)40(49993000)8.0cos(2
2999500)111.0cos(2)/(][
1
nnnn
fnxnx s
99995000)4.0cos(21 nn
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 26
Two Spectrograms ofvery Long Signalvery Long Signal
Window Lengths of L=301 and L=75; overlap 90%
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 27
MATLAB SpectrogramMATLAB Spectrogram• In MATLAB, useIn MATLAB, use
• Fs is the sampling frequency specified in samples/s• WINDOW:
S = spectrogram(X,WINDOW,NOVERLAP,NFFT,Fs,‘yaxis’)
sf• WINDOW:
- if a vector, extract segments of X of equal length, and then multiply window vector and data vector, element by element;
L
- If an integer, same as above but use a Hamming window of the specified length
- if unspecified, use default• NOVERLAP: (<WINDOW)
- Number of overlapping data between successive frames• NFFT: Length of FFTN
XN
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 28
g
Resolution TestResolution Test Closely spaced frequency componentsy p q y p How close can the lines be? Depends on window (section) length Inverse relationship
49990)227.0cos(5.1)2.0cos( nnn
99997000)7.0cos()6.0cos(369995000)2.0cos(
49990)227.0cos(5.1)2.0cos()/(][
nnnnn
nnnfnxnx s
)()(
80/810ˆ)70()60(3/?8027.0ˆ)227.0cos(5.1)2.0cos(
nn 296
18
ˆ )(
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 29
80/81.0)7.0cos()6.0cos(3 nn
![Page 8: DSP First, 2/e READING ASSIGNMENTSdspfirst.gatech.edu/archives/lectures/DSPFirst-L19-pp4.pdf · Resolution Test Closel y s p aced fre q uenc y com p onentsyp q y p How close can the](https://reader035.vdocument.in/reader035/viewer/2022071116/5ffe01be56c3ad1c94346d72/html5/thumbnails/8.jpg)
Two Spectrograms:Resolution TestResolution Test
Window Lengths of L=301 and L=75, overlap 90%
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 30
Short DFTs ofWindowed SectionsWindowed Sections
75-pt and 301-pt Hann windows. 1024-pt DFT (zero-padded)
Aug 2016 © 2003-2016, JH McClellan & RW Schafer 31