You are on page 1of 39

Short Time Fourier Transform (STFT)

CS474/674 – Prof. Bebis


Fourier Analysis

• Fourier analysis expands signals or functions in terms


of sinusoids (or complex exponentials).
• It reveals all frequency components present in a signal.

(inverse DFT)

where:
(forward DFT)
Examples

f1 (t )  cos(2  5  t )

f 2 (t )  cos(2  25  t )

f 3 (t )  cos(2  50  t )
Examples (cont’d)

F1(u)

F2(u)

F3(u)
Fourier Analysis – Examples (cont’d)

f 4 (t )  cos(2  5  t )
 cos(2  25  t )
 cos(2  50  t )

F4(u)
Limitations of Fourier Analysis (cont’d)

1. Cannot not provide simultaneous time and frequency


localization.

2. Not useful for analyzing time-variant, non-stationary


signals.

3. Not appropriate for representing discontinuities or


sharp corners (i.e., requires a large number of Fourier
components to represent discontinuities).
Fourier Analysis – Examples (cont’d)

f 4 (t )  cos(2  5  t )
 cos(2  25  t )
 cos(2  50  t )

Provides excellent
localization in the F4(u)
frequency domain
but poor localization
in the time domain.
Limitations of Fourier Analysis (cont’d)

1. Cannot not provide simultaneous time and frequency


localization.

2. Not useful for analyzing time-variant, non-stationary


signals.

3. Not appropriate for representing discontinuities or


sharp corners (i.e., requires a large number of Fourier
components to represent discontinuities).
Stationary vs non-stationary signals

• Stationary signals:
time-invariant spectra
f 4 (t )

• Non-stationary
signals: time-varying
spectra.
f 5 (t )
Stationary vs non-stationary signals
Stationary signal:

f 4 (t )

Three frequency
components,
present at all
times!
F4(u)
Stationary vs non-stationary signals (cont’d)

Non-stationary signal:
f 5 (t )

Perfect knowledge of what


frequencies exist, but no
Information about where
these frequencies are
located in time!

F5(u)
Limitations of Fourier Analysis (cont’d)

1. Cannot not provide simultaneous time and frequency


localization.

2. Not useful for analyzing time-variant, non-stationary


signals.

3. Not appropriate for representing discontinuities or


sharp corners (i.e., requires a large number of Fourier
components to represent discontinuities).
Representing discontinuities or sharp corners
Representing discontinuities or sharp corners
(cont’d)

FT
Representing discontinuities or sharp corners
(cont’d)
Reconstructed
Representing discontinuities or sharp corners
(cont’d)
Reconstructed
Representing discontinuities or sharp corners
(cont’d)
Reconstructed
Representing discontinuities or sharp corners
(cont’d)
Reconstructed
Representing discontinuities or sharp corners
(cont’d)
Reconstructed
Representing discontinuities or sharp corners
(cont’d)
Reconstructed
Representing discontinuities or sharp corners
(cont’d)
Reconstructed
Representing discontinuities or sharp corners
(cont’d)
Reconstructed Original
Short Time Fourier Transform (STFT)
 Need a local analysis scheme for a time-frequency
representation (TFR).
 Windowed F.T. or Short Time F.T. (STFT)
 Segmenting the signal into narrow time intervals (i.e.,
narrow enough to be considered stationary).
 Take the Fourier transform of each segment.
Short Time Fourier Transform (STFT)
(cont’d)
• Steps :
(1) Choose a window function of finite length
(2) Place the window on top of the signal at t=0
(3) Truncate the signal using this window
(4) Compute the FT of the truncated signal, save results.
(5) Incrementally slide the window to the right
(6) Go to step 3, until window reaches the end of the signal
Short Time Fourier Transform (STFT)

• For each time location where the window is centered,


we obtain a different FT
– Each FT provides the spectral information of a separate
time-slice of the signal, providing simultaneous time and
frequency information
Short Time Fourier Transform (STFT)
(cont’d)
Time Frequency Signal to
parameter parameter be analyzed

STFT fu (t , u )    f (t ) W (t  t )  e j 2 ut dt
t

STFT of f(t): Windowing centered at t=t’


computed for each function
window centered at t=t’
Short Time Fourier Transform (STFT)
(cont’d)
• STFT maps 1-D time domain signals to 2-D time-
frequency signals (i.e., in u and t’ )

STFT (t , u )    f (t ) W (t  t )  e

f
u
  j 2 ut
dt
t
Example

f(t)

[0 – 300] ms  100 Hz sinusoid


[300 – 600] ms  50 Hz sinusoid
[600 – 800] ms  25 Hz sinusoid
[800 – 1000] ms 10 Hz sinusoid
Example

STFTfu (t , u)

f(t)

W(t)

scaled: t/20
Choosing Window W(t)

• What shape?
– Rectangular, Gaussian, Elliptic…?

• How wide?
– Window should be narrow enough to make sure that the
portion of the signal falling within the window is stationary.
– Very narrow windows do not offer good localization in the
frequency domain.
STFT Window Size
STFT fu (t , u )    f (t ) W (t  t )  e j 2 ut dt
t

W(t) infinitely long: W (t )  1  STFT turns into FT,


providing excellent frequency localization, but no time
information.

W(t) infinitely short: W (t )   (t )  gives the time signal


back, with a phase factor, providing excellent time localization but
no frequency information.

STFT fu (t , u )    f (t )   (t  t )  e  j 2 ut dt  f (t )  e  jut 


t
STFT Window Size (cont’d)

• Wide window  good frequency resolution, poor


time resolution.

• Narrow window  good time resolution, poor


frequency resolution.
Example
different size windows

(four frequencies, non-stationary)


Example (cont’d)

STFTfu (t , u)

STFTfu (t , u)

scaled: t/20
Example (cont’d)

STFTfu (t , u)

STFTfu (t , u)

scaled: t/20
Multiresolution Analysis

• The issue of choosing the “right” window size in


STFT leads to the idea of analyzing a signal using
windows of different size!

• This is called “multi-scale” or “multi-resolution”


analysis which is the core of wavelets.
Multiresolution Analysis (cont’d)
• Many signals or images contain features at various
levels of detail (i.e., scales).

Small size objects should


be examined at a high
resolution.

Large size objects should


be examined at a low
resolution.
Heisenberg (or Uncertainty) Principle

1
t  f 
4

Time resolution: How well Frequency resolution: How


two spikes in time can be well two spectral components
separated from each other in can be separated from each
the transform domain. other in the transform domain

t and f cannot be made arbitrarily small !


Heisenberg (or Uncertainty) Principle
(cont’d)
• One cannot know the exact time-frequency
representation of a signal.
• We cannot precisely know at what time instance a
frequency component is located.
• We can only know what interval of frequencies are
present in which time intervals.

You might also like