Skip to content

The final project of the Digital Signal Processing Course (DGT301)

License

Notifications You must be signed in to change notification settings

dy-le/Short_time_Fourier_transform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Short-time Fourier transform

The final project of the Digital Signal Processing Course (DGT301)

The Short-time Fourier transform (STFT), is a Fourier-related transform used to determine the sinusoidal frequency and phase content of local sections of a signal as it changes over time. In practice, the procedure for computing STFTs is to divide a longer time signal into shorter segments of equal length and then compute the Fourier transform separately on each shorter segment. This reveals the Fourier spectrum on each shorter segment. One then usually plots the changing spectra as a function of time, known as a spectrogram or waterfall plot.

Forward STFT


Continuous-time STFT

Simply, in the continuous-time case, the function to be transformed is multiplied by a window function which is nonzero for only a short period of time. The Fourier transform (a one-dimensional function) of the resulting signal is taken as the window is slid along the time axis, resulting in a two-dimensional representation of the signal. Mathematically, this is written as:

where is the window function, commonly a Hann window or Gaussian window centered around zero, and x(t) is the signal to be transformed (note the difference between the window function w and the frequency ). is essentially the Fourier Transform of , a complex function representing the phase and magnitude of the signal over time and frequency. Often phase unwrapping is employed along either or both the time axis, , and frequency axis, , to suppress any jump discontinuity of the phase result of the STFT. The time index is normally considered to be "slow" time and usually not expressed in as high resolution as time t.

Discrete-time STFT

In the discrete time case, the data to be transformed could be broken up into chunks or frames (which usually overlap each other, to reduce artifacts at the boundary). Each chunk is Fourier transformed, and the complex result is added to a matrix, which records magnitude and phase for each point in time and frequency. This can be expressed as:

likewise, with signal x[n] and window w[n]. In this case, m is discrete and ω is continuous, but in most typical applications the STFT is performed on a computer using the Fast Fourier Transform, so both variables are discrete and quantized.

The magnitude squared of the STFT yields the spectrogram representation of the Power Spectral Density of the function:

Sliding DFT

If only a small number of ω are desired, or if the STFT is desired to be evaluated for every shift m of the window, then the STFT may be more efficiently evaluated using a sliding DFT algorithm.

Inverse STFT

The STFT is invertible, that is, the original signal can be recovered from the transform by the Inverse STFT. The most widely accepted way of inverting the STFT is by using the overlap-add (OLA) method, which also allows for modifications to the STFT complex spectrum. This makes for a versatile signal processing method, referred to as the overlap and add with modifications method.

Continuous-time STFT

Given the width and definition of the window function w(t), we initially require the area of the window function to be scaled so that

It easily follows that

and

The continuous Fourier Transform is

Substituting x(t) from above:

Swapping order of integration:

So the Fourier Transform can be seen as a sort of phase coherent sum of all of the STFTs of x(t). Since the inverse Fourier transform is

then x(t) can be recovered from X(τ,ω) as

or

It can be seen, comparing to above that windowed "grain" or "wavelet" of x(t) is

the inverse Fourier transform of X(τ,ω) for τ fixed.

About

The final project of the Digital Signal Processing Course (DGT301)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published