<< 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 $N$ equally spaced samples from $=0$ to $=2\pi $ .
In this definition, the overlap between adjacent blocks is $R-1$ . 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 $${X}^{d}(k, Lm)$$ where $L$ is the time-skip. The relation between the time-skip, the number ofoverlapping samples, and the block length is $$\mathrm{Overlap}=R-L$$
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: $$L\in \{1, 10\}$$ $$N\in \{32, 256\}$$
For each of the four spectrograms in can you tell what $L$ and $N$ are?
$L$ and $N$ 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. $$R\in \{120, 256, 1024\}$$ $$L\in \{35, 250\}$$ where
For each of the four spectrograms in , match the above values of $L$ and $R$ .
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 'The dft, fft, and practical spectral analysis' conversation and receive update notifications?