Connexions

You are here: Home » Content » Digital Signal Processing: A User's Guide » Short Time Fourier Transform

Lenses

What is a lens?

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

In these lenses

• Lens for Engineering

This module is included inLens: Lens for Engineering
By: Sidney Burrus

Click the "Lens for Engineering" link to see all content selected in this lens.

• SigProc

This module is included inLens: Signal Processing
By: Daniel McKennaAs a part of collection: "Fundamentals of Signal Processing"

Click the "SigProc" link to see all content selected in this lens.

Click the tag icon to display tags associated with this content.

Recently Viewed

This feature requires Javascript to be enabled.

Tags

(What is a tag?)

These tags come from the endorsement, affiliation, and other lenses that include this content.

Inside Collection (Course):

Course by: Douglas L. Jones. E-mail the author

Short Time Fourier Transform

Module by: Ivan Selesnick. E-mail the author

Summary: Introduction to the Short Time Fourier Transform, which includes it's definition and methods for its use.

Short Time Fourier Transform

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.

Note:

To see how the frequency content of a signal changes over time, we can cut the signal into blocks and compute the spectrum of each block.
To improve the result,
1. blocks are overlapping
2. each block is multiplied by a window that is tapered at its endpoints.
Several parameters must be chosen:
• Block length, RR.
• The type of window.
• Amount of overlap between blocks. (Figure 1)
• Amount of zero padding, if any.

The short-time Fourier transform is defined as

Xωm=STFTxnDTFTxnmwn= n =xnmwne(jωn)= n =0R1xnmwne(jωn) X ω m STFT x n DTFT x n m w n n x n m w n ω n n 0 R 1 x n m w n ω n
(1)
where wn w n is the window function of length RR.
1. The STFT of a signal xn x n is a function of two variables: time and frequency.
2. The block length is determined by the support of the window function wn w n .
3. A graphical display of the magnitude of the STFT, |Xωm| X ω m , is called the spectrogram of the signal. It is often used in speech processing.
4. The STFT of a signal is invertible.
5. One can choose the block length. A long block length will provide higher frequency resolution (because the main-lobe of the window function will be narrow). A short block length will provide higher time resolution because less averaging across samples is performed for each STFT value.
6. A narrow-band spectrogram is one computed using a relatively long block length RR, (long window function).
7. A wide-band spectrogram is one computed using a relatively short block length RR, (short window function).

Sampled STFT

To numerically evaluate the STFT, we sample the frequency axis ωω in NN equally spaced samples from ω=0 ω 0 to ω=2π ω 2 .

k,0kN1: ω k =2πNk k 0 k N 1 ω k 2 N k
(2)
We then have the discrete STFT,
X d kmX2πNkm= n =0R1xnmwne(jωn)= n =0R1xnmwn W N (kn)= DFT N xnmwn|n=0R10,…0 X d k m X 2 N k m n 0 R 1 x n m w n ω n n 0 R 1 x n m w n W N k n DFT N n 0 R 1 x n m w n 0,…0
(3)
where 0,…00,…0 is NRNR .

In this definition, the overlap between adjacent blocks is R1 R 1 . The signal is shifted along the window one sample at a time. That generates more points than is usually needed, so we also sample the STFT along the time direction. That means we usually evaluate X d kLm X d k L m where LL is the time-skip. The relation between the time-skip, the number of overlapping samples, and the block length is Overlap=RL Overlap R L

Exercise 1

Match each signal to its spectrogram in Figure 2.

Spectrogram Example

The matlab program for producing the figures above (Figure 3 and Figure 4).



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')



Effect of window length R

Here is another example to illustrate the frequency/time resolution trade-off (See figures - Figure 5, Figure 6, and Figure 7).

Effect of L and N

A spectrogram is computed with different parameters: L110 L 1 10 N32256 N 32 256

• LL = time lapse between blocks.
• NN = FFT length (Each block is zero-padded to length NN.)
In each case, the block length is 30 samples.

Exercise 2

For each of the four spectrograms in Figure 8 can you tell what LL and NN are?

LL and NN do not effect the time resolution or the frequency resolution. They only affect the 'pixelation'.

Effect of R and L

Shown below are four spectrograms of the same signal. Each spectrogram is computed using a different set of parameters. R1202561024 R 120 256 1024 L35250 L 35 250 where

• RR = block length
• LL = time lapse between blocks.

Exercise 3

For each of the four spectrograms in Figure 9, match the above values of LL and RR.

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.

Content actions

PDF | EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

PDF | EPUB (?)

What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

Collection to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks

Module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

Definition of a lens

Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual member, a community, or a respected organization.

What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks

Reuse / Edit:

Reuse or edit collection (?)

Check out and edit

If you have permission to edit this content, using the "Reuse / Edit" action will allow you to check the content out into your Personal Workspace or a shared Workgroup and then make your edits.

Derive a copy

If you don't have permission to edit the content, you can still use "Reuse / Edit" to adapt the content by creating a derived copy of it and then editing and publishing the copy.

| Reuse or edit module (?)

Check out and edit

If you have permission to edit this content, using the "Reuse / Edit" action will allow you to check the content out into your Personal Workspace or a shared Workgroup and then make your edits.

Derive a copy

If you don't have permission to edit the content, you can still use "Reuse / Edit" to adapt the content by creating a derived copy of it and then editing and publishing the copy.