71
Copyright © 2001, S. K. Mitra 1 Spectral Analysis of Signals Spectral Analysis of Signals Spectral analysis is concerned with the determination of frequency contents of a continuous-time signal using DSP methods It involves the determination of either the energy spectrum or the power spectrum of the signal • If is sufficiently bandlimited, spectral characteristics of its discrete-time equivalent g[n] should provide a good estimate of spectral characteristics of ) (t g a ) (t g a ) (t g a

Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Embed Size (px)

Citation preview

Page 1: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra1

Spectral Analysis of SignalsSpectral Analysis of Signals• Spectral analysis is concerned with the

determination of frequency contents of acontinuous-time signal using DSPmethods

• It involves the determination of either theenergy spectrum or the power spectrum ofthe signal

• If is sufficiently bandlimited, spectralcharacteristics of its discrete-timeequivalent g[n] should provide a goodestimate of spectral characteristics of

)(tga

)(tga

)(tga

Page 2: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra2

Spectral Analysis of SignalsSpectral Analysis of Signals• In most cases, is defined for• Thus, g[n] is of infinite extent, and defined

for• Hence, is first passed through an

analog anti-aliasing filter whose output isthen sampled to generate g[n]

• Assumptions: (1) Effect of aliasing can beignored, (2) A/D conversion noise can beneglected

)(tga

)(tga

∞<<∞− t

∞<<∞− n

Page 3: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra3

Spectral Analysis of SignalsSpectral Analysis of Signals

• Three types of spectral analysis -• 1) Spectral analysis of stationary sinusoidal

signals• 2) Spectral analysis of of nonstationary

signals with time-varying parameters• 3) Spectral analysis of random signals

Page 4: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra4

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• Assumption - Parameters characterizingsinusoidal signals, such as amplitude,frequencies, and phase, do not change withtime

• For such a signal g[n], the Fourier analysiscan be carried out by computing the DTFT

∑=∞

−∞=

n

njj engeG ωω ][)(

Page 5: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra5

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• In practice, the infinite-length sequence g[n]is first windowed by multiplying it with alength-N window w[n] to convert it into alength-N sequence

• DTFT of then is assumed toprovide a reasonable estimate of

• is evaluated at a set of R ( )discrete angular frequencies equally spacedin the range by computing theR-point FFT of

][nγ][nγ

)( ωjeG)( ωjeΓ

)( ωjeΓ NR ≥

πω 20 ≤≤][nγ][kΓ

Page 6: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra6

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• We analyze the effect of windowing and theevaluation of the frequency samples of theDTFT via the DFT

• Now

• The normalized discrete-time angularfrequency corresponding to the DFT binnumber k (DFT frequency) is given by

10,)(][/2

−≤≤Γ=Γ=

RkekRk

jπω

ω

Rk

kπω 2=

Page 7: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra7

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• The continuous-time angular frequencycorresponding to the DFT bin number k(DFT frequency) is given by

• To interpret the results of DFT-basedspectral analysis correctly we first considerthe frequency-domain analysis of asinusoidal signal

RTk

kπ2=Ω

Page 8: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra8

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• Consider• It can be expressed as

• Its DTFT is given by

∞<<∞−+= nnng o ),cos(][ φω

( ))()(21][ φωφω +−+ += njnj oo eeng

∑ +−=∞

−∞=ll)2()( πωωδπ φω

ojj eeG

∑ +−+∞

−∞=

ll)2( πωωδπ φ

oje

Page 9: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra9

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• is a periodic function of ω with aperiod 2π containing two impulses in eachperiod

• In the range , there is an impulseat of complex amplitude andan impulse at of complexamplitude

• To analyze g[n] using DFT, we employ afinite-length version of the sequence givenby

)( ωjeG

πωπ ≤≤−oωω =

oωω −=φπ je

φπ je−

10),cos(][ −≤≤+= Nnnn o φωγ

Page 10: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra10

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• Example - Determine the 32-point DFT of alength-32 sequence g[n] obtained bysampling at a rate of 64 Hz a sinusoidalsignal of frequency 10 Hz

• Since Hz is much larger than theNyquist frequency of 20 Hz, there is noaliasing due to sampling

)(tga64=TF

Page 11: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra11

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• DFT magnitude plot

• Since γ[n] is a pure sinusoid, its DTFT contains two impulses at

and is zero everywhere else)( 2 fje πΓ Hz10±=f

0 10 20 300

5

10

15

k

| Γ[k

]|

Page 12: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra12

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• Its 32-point DFT is obtained by sampling at

• The impulse at f = 10 Hz appears as Γ[5] atthe DFT frequency bin location

and the impulse at appears asΓ[27] at bin location

)( 2 fje πΓ ,232/264 Hzkf =×= 310 ≤≤ k

Hz10−=f27532 =−=k

564

3210=

×==

TFRfk

Page 13: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra13

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• Note: For an N-point DFT, first half DFTsamples for k = 0 tocorresponds to the positive frequency axisfrom f = 0 to excluding the point

and the second half for k = N/2 to corresponds to the negative

frequency axis from to f = 0excluding the point f = 0

2/TFf =

1−= Nk2/TFf −=

1)2/( −= Nk

2/TFf =

Page 14: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra14

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• Example - Determine the 32-point DFT of alength-32 sequence γ[n] obtained bysampling at a rate of 64 Hz a sinusoidalsignal of frequency 11 Hz

• Since γ[n] is a pure sinusoid, its DTFT contains two impulses at

and is zero everywhere else

)(txa

)( 2 fje πΓ Hz11±=f

Page 15: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra15

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• Since

the impulse at f = 11 Hz of the DTFTappear between the DFT bin locations k = 5and k = 6

• Likewise, the impulse at Hz of theDTFT appear between the DFT binlocations k = 26 and k = 27

5.564

3211=

×=

TFRf

11−=f

Page 16: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra16

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• DFT magnitude plot

• Note: Spectrum contains frequencycomponents at all bins, with two strongcomponents at k = 5 and k = 6, and twostrong components at k = 26 and k = 27

0 10 20 300

5

10

15

k

| Γ[k

]|

Page 17: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra17

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• The phenomenon of the spread of energyfrom a single frequency to many DFTfrequency locations is called leakage

• To understand the cause of leakage, recallthat the N-point DFT Γ[k] of a length-Nsequence γ[n] is given by the samples of itsDTFT :

10,)(][/2

−≤≤Γ=Γ=

NkekNk

j

k

k

πωω

)( ωjeΓ

Page 18: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra18

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• Plot of the DTFT of the length-32 sinusoidalsequence of frequency 11 Hz sampled at 64Hz is shown below along with its 32-pointDFT

π2

0 10 20 300

5

10

15

k

| Γ[k

]|

|Γ(ejω)|

Page 19: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra19

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• The DFT samples are indeed obtained bythe frequency samples of the DTFT

• Now the sequence

has been obtained by windowing theinfinite-length sinusoidal sequence g[n]with a rectangular window w[n]:

10),cos(][ −≤≤+= Nnnn o φωγ

−≤≤= otherwise,0

10,1][ Nnnw

Page 20: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra20

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• The DTFT of γ[n] is given by

where is the DTFT of g[n]:

and is the DTFT of w[n]:

)( ωjeΓ

)( ωjeΨ

ϕπ

π

ϕωϕπ

ω deeGe jjj ∫ Ψ=Γ−

− )()()( )(21

)2/sin()2/sin()( 2/)1(

ωωωω Nee Njj −−=Ψ

)( ωjeG

)2()( ll

πωωδπ φω +−∑=∞

−∞=o

jj eeG)2( l

lπωωδπ φ ++∑+

−∞=

−o

je

Page 21: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra21

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• Hence

• Thus, is a sum of frequency shiftedand amplitude scaled DTFT withthe amount of shifts given by

• For the length-32 sinusoid of frequency 11Hz sampled at 64 Hz, normalized angularfrequency of the sinusoid is 11/64 = 0.172

)()( )(21 ojjj eee ωωφω −Ψ=Γ )( )(

21 ojj ee ωωφ +− Ψ+

)( ωjeΨ)( ωjeΓ

oω±

Page 22: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra22

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• Its DTFT is obtained by frequencyshifting the DTFT to the right and tothe left by the amount ,adding both shifted versions and scaling thesum by a factor of 1/2

• In the frequency range , which isone period of the DTFT, there are two peaks,one at 0.344π and the other at

)( ωjeΓ)( ωjeΨ

ππ 344.02172.0 =×

πω 20 ≤≤

)172.01(2 −ππ656.1=

Page 23: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra23

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• Plot of and the 32-point DFT |Γ[k]||)(| ωjeΓ

0 10 20 300

5

10

15

k

| Γ[k

]|

|Γ(ejω)|

0 π2ω

Page 24: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra24

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• The two peaks of |Γ[k]| located at binlocations k = 5 and k = 6 are frequencysamples on both sides of the main lobelocated at 0.172

• The two peaks of |Γ[k]| located at binlocations k = 26 and k = 27 are frequencysamples on both sides of the main lobelocated at 0.828

Page 25: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra25

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• All other DFT samples are given by thesamples of the sidelobes of causingthe leakage of the frequency components atto other bin locations with the amount ofleakage determined by the relativeamplitudes of the main lobe and the sidelobes

• Since the relative sidelobe level of therectangular window is very high, there is aconsiderable amount of leakage to the binlocations adjacent to the main lobes

)( ωjeΨ

lsA

Page 26: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra26

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• Problem gets more complicated if thesignal being analyzed has more than onesinusoid

• We now examine the effects of the length Rof the DFT, the type of window being used,and its length N on the results of spectralanalysis

• Consider10),2sin()2sin(][ 212

1 −≤≤+= Nnnfnfnx ππ

Page 27: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra27

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• Example -

• From the above plot it is difficult to determinewhether there is one or more sinusoids in x[n]and the exact locations of the sinusoids

34.0,22.0,16 21 === ffN

0 5 10 150

2

4

6

k

|X[k

]|

N = 16, R = 16

Page 28: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra28

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• An increase in the DFT length to R = 32leads to some concentrations around k = 7and k = 11 in the normalized frequencyrange from 0 to 0.5

0 10 20 300

2

4

6

8

k

|X[k

]|

N = 16, R = 32

Page 29: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra29

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• There are two clear peaks when R = 64

0 20 40 600

2

4

6

8

k

|X[k

]|

N = 16, R = 64

Page 30: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra30

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• An increase in the accuracy of the peaklocations is obtained by increasing DFTlength to R = 128 with peaks occurring atk = 27 and k =45

0 50 1000

2

4

6

8

k

|X[k

]|

N = 16, R = 128

Page 31: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra31

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• However, there are a number of minorpeaks and it is not clear whether additionalsinusoids of lesser strengths are present

• General conclusion - An increase in theDFT length improves the sampling accuracyof the DTFT by reducing the spectralseparation of adjacent DFT samples

Page 32: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra32

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• Example - varied from 0.28 to 0.31

• The two sinusoids are clearly resolved inboth cases

34.0,128,16 2 === fRN1f

0 50 1000

2

4

6

8

10

k

|X[k

]|

f1 = 0.28, f

2 = 0.34

0 50 1000

2

4

6

8

10

k

|X[k

]|

f1 = 0.29, f

2 = 0.34

Page 33: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra33

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• The two sinusoids cannot be resolved inboth cases

0 50 1000

2

4

6

8

10

k

|X[k

]|

f1 = 0.3, f

2 = 0.34

0 50 1000

2

4

6

8

10

k

|X[k

]|

f1 = 0.31, f

2 = 0.34

Page 34: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra34

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• Reduced resolution occurs when thedifference between the two frequenciesbecomes less than 0.4

• The DTFT is obtained by summingthe DTFTs of the two sinusoids

• As the difference between the twofrequencies get smaller, the main lobes ofthe individual DTFTs get closer andeventually overlap

)( ωjeΓ

Page 35: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra35

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• If there is significant overlap, it will bedifficult to resolve the two peaks

• Frequency resolution is determined by thewidth of the main lobe of the DTFT ofthe window

• For a length-N rectangular window• In terms of normalized frequency, for N =

16, main lobe width is 0.125

ML∆

124

+π=∆

MML

Page 36: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra36

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• Thus, two closely spaced sinusoidswindowed by a length-16 rectangularwindow can be resolved if the difference inthe frequencies is about half the main lobewidth, i.e., 0.0625

• Rectangular window has the smallest mainlobe width and has the smallest frequencyresolution

Page 37: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra37

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• But the rectangular window has the largestsidelobe amplitude causing considerableleakage

• From the previous two examples, it can beseen that the large amount of leakage resultsin minor peaks that may be identifiedfalsely as sinusoids

• Leakage can be reduced by using othertypes of windows

Page 38: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra38

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• Example -

windowed by a length-R Hamming window

• Leakage has been reduced considerably, butit is difficult to resolve the two sinusoids

)26.02sin()22.02sin(85.0][ ×+×= ππnx

0 5 10 150

2

4

6

8

k

|X[k

]|

N = 16, R = 16

0 20 40 600

2

4

6

8

k

|X[k

]|

N = 16, R = 64

Page 39: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra39

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• An increase in the DFT length results in asubstantial reduction of leakage, but the twosinusoids still cannot be resolved

0 10 20 300

2

4

6

8

k

|X[k

]|

N = 32, R = 32

0 10 20 300

2

4

6

8

k

|X[k

]|

N = 32, R = 32

Page 40: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra40

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• The main lobe width of a length-NHamming window is 8π/N

• For N = 16, normalized main lobe width is0.25

• Two frequencies can thus be resolved if theirdifference is of the order of half of the mainlobe width, i.e., 0.125

• In the example considered, the difference is0.04, which is much smaller

ML∆

Page 41: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra41

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• To increase the resolution, increase thewindow length to R = 32 which reduces themain lobe width by half

• There now appears to be two peaks0 50 100 150 200 250

0

2

4

6

8

k

|X[k

]|

N = 32, R = 256

Page 42: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra42

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• An increase of the DFT size to R = 64clearly separates the two peaks

• Separation is more visible for R = 256

0 50 100 150 200 2500

5

10

15

k

|X[k

]|

N = 64, R = 256

Page 43: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra43

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• General conclusions - Performance of DFT-based spectral analysis depends on threefactors: (1) Type of window, (2) Windowlength, and (3) Size of the DFT

• Frequency resolution is increased by using awindow with a very small main lobe width

• Leakage is reduced by using a window witha very small relative sidelobe level

Page 44: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra44

Spectral Analysis ofSpectral Analysis ofSinusoidal SignalsSinusoidal Signals

• Main lobe width can be reduced byincreasing the window length

• An increase in the accuracy of locatingpeaks is obtained by increasing the DFTlength

• It is preferable to use a DFT length that is apower of 2 so that very efficient FFTalgorithms can be employed

• An increase in DFT size increases thecomputational complexity

Page 45: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra45

Spectral Analysis ofSpectral Analysis ofNonstationaryNonstationary Signals Signals

• DFT can be employed for spectral analysisof a length-N sinusoidal signal composed ofsinusoidal signals as long as the frequency,amplitude and phase of each sinusoidalcomponent are time-invariant andindependent of N

• There are situations where the signal beinganalyzed is instead nonsationary, for whichthese parameters are time-varying

Page 46: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra46

Spectral Analysis ofSpectral Analysis ofNonstationaryNonstationary Signals Signals

• An example of a time-varying signal is thechirp signal and shownbelow for

• The instantaneous frequency of x[n] is

51010 −×= πωo

)cos(][ 2nAnx oω=

noω2

0 100 200 300 400 500 600 700 800

-1

-0.5

0

0.5

1

Time index n

Am

plitu

de

Page 47: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra47

Spectral Analysis ofSpectral Analysis ofNonstationaryNonstationary Signals Signals

• Other examples of such nonstationarysignals are speech, radar and sonar signals

• DFT of the complete signal will providemisleading results

• A practical approach would be to segmentthe signal into a set of subsequences ofshort length with each subsequence centeredat uniform intervals of time and computeDFTs of each subsequence

Page 48: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra48

Spectral Analysis ofSpectral Analysis ofNonstationaryNonstationary Signals Signals

• The frequency-domain description of thelong sequence is then given by a set ofshort-length DFTs, i.e., a time-dependentDFT

• To represent a nonstationary x[n] in termsof a set of short-length subsequences, x[n] ismultiplied by a window w[n] that isstationary with respect to time and movex[n] through the window

Page 49: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra49

Spectral Analysis ofSpectral Analysis ofNonstationaryNonstationary Signals Signals

• Four segments of the chirp signal as seenthrough a stationary length-200 rectangularwindow

100 150 200 250 300-1

0

1

Time index nA

mpl

itude

0 50 100 150 200-1

0

1

Time index n

Am

plitu

de

200 250 300 350 400-1

0

1

Time index n

Am

plitu

de

300 350 400 450 500-1

0

1

Time index n

Am

plitu

de

Page 50: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra50

Short-Time Fourier TransformShort-Time Fourier Transform

• Short-time Fourier transform (STFT),also known as time-dependent Fouriertransform of a signal x[n] is defined by

where w[m] is a suitably chosen windowsequence

∑ −=∞

−∞=

m

mjj emwmnxneX ωω ][][),(STFT

Page 51: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra51

Short-Time Fourier TransformShort-Time Fourier Transform

• The STFT is also defined as given below:

• Here, if w[n] = 1 for all values of n, theSTFT reduces to DTFT of x[n]

∑ −=∞

−∞=

ω−ω

m

mjj emnwmxneX ][][),(STFT

Page 52: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra52

Short-Time Fourier TransformShort-Time Fourier Transform

• Even though DTFT of x[n] exists undercertain well-defined conditions, windowedx[n] being of finite length ensures theexistence of any x[n]

• Function of w[n] is to extract a finite-lengthportion of x[n] such that the spectralcharacteristics of the extracted section areapproximately stationary

Page 53: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra53

Short-Time Fourier TransformShort-Time Fourier Transform• is a function of 2 variables:

integer variable time index n andcontinuous frequency variable ω

• is a periodic function of ωwith a period 2π

• Display of is usuallyreferred to as spectrogram

• Display of spectrogram requires normallythree dimensions

),(STFT neX jω

),(STFT neX jω

),(STFT neX jω

Page 54: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra54

Short-Time Fourier TransformShort-Time Fourier Transform

• Often, STFT magnitude is plotted in twodimensions with the magnitude representedby the darkness of the plot

• Plot of STFT magnitude of chirp sequence with

for a length of 20,000 samples computedusing a Hamming window of length 200shown next

)cos(][ 2nAnx oω= 51010 −×= πωo

Page 55: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra55

Short-Time Fourier TransformShort-Time Fourier Transform

• STFT for a given value of n is essentiallythe DFT of a segment of an almostsinusoidal sequence

Time

Freq

uenc

y

0 5000 10000 150000

0.1

0.2

0.3

0.4

0.5

Page 56: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra56

Short-Time Fourier TransformShort-Time Fourier Transform• Shape of the DFT of such a sequence is

similar to that shown below• Large nonzero-valued DFT samples around

the frequency of the sinusoid• Smaller nonzero-valued DFT samples at

other frequency points

0 0.5π π 1.5π 2π 0

5

10

15

20

ω

Mag

nitu

de

Page 57: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra57

Short-Time Fourier TransformShort-Time Fourier Transform• In the spectrogram plot, large-valued DFT

samples show up as narrow very short darkvertical lines

• Other DFT samples show up as points• As the instantaneous frequency of the chirp

signal increases linearly with n, short darkline move up in the vertical direction

• Because of aliasing, dark line starts movingdown in the vertical direction

• Spectrogram appears in a triangular shape

Page 58: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra58

Short-Time Fourier TransformShort-Time Fourier Transform• In practice, the STFT is computed at a finite

set of discrete values of ω• The STFT is accurately represented by its

frequency samples as long as the number offrequency samples N is greater than windowlength R

• The portion of the sequence x[n] inside thewindow can be fully recovered from thefrequency samples of the STFT

Page 59: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra59

Short-Time Fourier TransformShort-Time Fourier Transform• Sampling at N equally

spaced frequencies , withwe get

• If , is simply the R-point DFT of

),(STFT neX jω

Nkk /2πω = RN ≥

( )Nk

j neXnkX/2STFTSTFT ,],[

πωω

==

10,][][1

0

/2 −≤≤∑ −=−

=

− NkemwmnxR

m

Nkmj π

],[STFT nkX][][ mwmnx −

0][ ≠mw

Page 60: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra60

Short-Time Fourier TransformShort-Time Fourier Transform• is a 2-D sequence and periodic

in k with a period N• Applying the IDFT we get

or

• Thus the sequence inside the window can befully recovered from

],[STFT nkX

10,],[1][][1

0

/2 −≤≤∑=−−

=RmenkX

Nmwmnx

N

k

Nmkj π

10,],[][

1][1

0

/2 −≤≤∑=−−

=RmenkX

mwNmnx

N

k

Nmkj π

Page 61: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra61

Short-Time Fourier TransformShort-Time Fourier Transform

• The sampled STFT for a window defined inthe region is given by

where and k are integers such that and

),(],[ /2STFTSTFT LeXLkX Nkj ll π=

l

∑ −=−

=

−1

0

/2][][R

m

NmkjemwmLx πl

∞<<∞− l 10 −≤≤ Nk

10 −≤≤ Rm

Page 62: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra62

Short-Time Fourier TransformShort-Time Fourier Transform• Figure below shows lines in the (ω,n)-plane

corresponding to for N = 9and L = 4

),(STFT neX jω

Page 63: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra63

Short-Time Fourier TransformShort-Time Fourier Transform• Figure below shows the grid of sampling

points in (ω,n)-plane for N = 9 and L = 4

l0 1 2 3

k

01234

1−N

Page 64: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra64

Short-Time Fourier TransformShort-Time Fourier Transform

• As we have shown it is possible to uniquelyreconstruct the original signal from such a2-D discrete representation provided

where N is the DFT length, R is the windowlength and L is the sampling period in time

NRL ≤≤

Page 65: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra65

STFT Window SelectionSTFT Window Selection

• The function of the window w[n] is toextract a portion of the signal x[n] andensure that the extracted section isapproximately stationary

• To the end, the window length L should besmall, in particular for signals with widelyvarying spectral parameters

Page 66: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra66

STFT Window SelectionSTFT Window Selection

• A decrease in the window length increasesthe time resolution property of the STFT

• On the other hand, the frequency resolutionproperty of the STFT increases with anincrease in the window length

• A shorter window provides a widebandspectrogram, whereas, a longer windowresults in a narrowband spectrogram

Page 67: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra67

STFT Window SelectionSTFT Window Selection

• Parameters characterizing the DTFT of awindow are the main lobe width andthe relative sidelobe amplitude

• determines the ability of the windowto resolve two sinusoidal components in thevicinity of each other

• controls the degree of leakage of onecomponent into a nearby signal component

ML∆

ML∆lsA

lsA

Page 68: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra68

STFT Window SelectionSTFT Window Selection

• In order to obtain a reasonably goodestimate of the frequency spectrum of atime-varying signal, the window should bechosen to have very small with a lengthR chosen based on the acceptable accuracyof the frequency and time resolutions

lsA

Page 69: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra69

STFT Computation UsingSTFT Computation UsingMATLABMATLAB

• The M-file specgram can be used tocompute the STFT of a signal

• The application of specgram is illustratednext

A speech signal of duration 4001 samples

Page 70: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra70

STFT Computation UsingSTFT Computation UsingMATLABMATLAB

• Using Program 11_4 we compute thenarrowband spectrogram of this speechsignal

Page 71: Spectral Analysis of Signals - Signal and Image …sip.cua.edu/res/docs/courses/ee515/chapter11/ch11-1.pdf1 Spectral Analysis of Signals • Spectral analysis is concerned with the

Copyright © 2001, S. K. Mitra71

STFT Computation UsingSTFT Computation UsingMATLABMATLAB

• The wideband spectrogram of the speechsignal is shown below

• The frequency and time resolution tradeoffbetween the two spectrograms can be seen