Summary: Introduction to the Short Time Fourier Transform, which includes it's definition and methods for its use.
Note: Your browser may not currently support MathML. See our browser support page for additional details. You can always view the correct math in the PDF version.
The Fourier transforms (FT, DTFT, DFT, etc.) do not clearly indicate how the frequency content of a signal changes over time.
That information is hidden in the phase - it is not revealed by the plot of the magnitude of the spectrum.
| STFT: Overlap Parameter |
|---|
![]() |
The short-time Fourier transform is defined as
To numerically evaluate the STFT, we sample the frequency
axis
In this definition, the overlap between adjacent blocks is
![]() |
![]() |
The matlab program for producing the figures above (Figure 3 and Figure 4).
% LOAD DATA
load mtlb;
x = mtlb;
figure(1), clf
plot(0:4000,x)
xlabel('n')
ylabel('x(n)')
% SET PARAMETERS
R = 256; % R: block length
window = hamming(R); % window function of length R
N = 512; % N: frequency discretization
L = 35; % L: time lapse between blocks
fs = 7418; % fs: sampling frequency
overlap = R - L;
% COMPUTE SPECTROGRAM
[B,f,t] = specgram(x,N,fs,window,overlap);
% MAKE PLOT
figure(2), clf
imagesc(t,f,log10(abs(B)));
colormap('jet')
axis xy
xlabel('time')
ylabel('frequency')
title('SPECTROGRAM, R = 256')
| Narrow-band spectrogram: better frequency resolution |
|---|
![]() |
| Wide-band spectrogram: better time resolution |
|---|
![]() |
Here is another example to illustrate the frequency/time resolution trade-off (See figures - Figure 5, Figure 6, and Figure 7).
| Effect of Window Length R | ||||
|---|---|---|---|---|
|
A spectrogram is computed with different parameters:
For each of the four spectrograms in Figure 8 can you tell what
|
Shown below are four spectrograms of the same signal. Each
spectrogram is computed using a different set of parameters.
For each of the four spectrograms in Figure 9, match the above values
of
![]() |
If you like, you may listen to this signal with the
soundsc command; the data is in the
file: stft_data.m. Here is a figure
of the signal.
![]() |