<< Chapter < Page | Chapter >> Page > |
The Fourier transforms (FT, DTFT, DFT,
That information is hidden in the phase - it is not revealed by the plot of the magnitude of the spectrum.
The short-time Fourier transform is defined as
To numerically evaluate the STFT, we sample the frequency axis in equally spaced samples from to .
In this definition, the overlap between adjacent blocks is . The signal is shifted along the window one sample at a time. That generates more points than is usuallyneeded, so we also sample the STFT along the time direction. That means we usually evaluate where is the time-skip. The relation between the time-skip, the number ofoverlapping samples, and the block length is
The matlab program for producing the figures above ( and ).
% 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')
Here is another example to illustrate the frequency/time resolution trade-off (See figures - , , and ).
A spectrogram is computed with different parameters:
For each of the four spectrograms in can you tell what and are?
and do not effect the time resolution or the frequency resolution. They only affect the'pixelation'.
Shown below are four spectrograms of the same signal. Each spectrogram is computed using a different set of parameters. where
For each of the four spectrograms in , match the above values of and .
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.
Notification Switch
Would you like to follow the 'Fundamentals of signal processing' conversation and receive update notifications?