# Short Time Fourier Transform STFT

Cuthbert Nyack
One of the shortcomings of the Fourier Transform is that it does not give any information on the time at which a frequency component occurs. This is not a problem for "stationary" signals but does leave room for improvement when nonstationary signals are involved. Consider a signal consisting of 2 frequencies, one frequency f1 existing over an interval T and the second a frequency f2 existing ovar another interval T. The Fourier Transform gives 2 sinc functions existing over all time.
One approach which can give information on the time resolution of the spectrum is the short time fourier transform (STFT). Here a moving window is applied to the signal and the fourier transform is applied to the signal within the window as the window is moved.
If a signal consists of 2 frequencies, f2 over on interval w and f1 over an adjacent interval w, then the STFT which would be obtained when a window of width tw is used is indicated in the applet following. The plot has frequency as one axis and time as the other. When th = 0 the view is along the frequency axis. Only positive frequencies are shown and the magnitude of the transform is plotted. In this case the signal consists of frequency f1 of width w to the left of the center and frequency 2f1 to the right of the center. Frequency scale is from 0 to 3f1.

Reducing tw produces a reduction in the frequency resolution and an increase in the time resolution. Increasing tw has the opposite effect. Note that the frequency and time resolution depends on the window and not on the frequency.
For simplicity a Rectangular window is used here, other "gentler" windows are also used and will produce a spectrum with smaller sidelobes.
Some real signals have long duration low frequencies and short duration high frequencies. Such a signal could be better described by a transform which has a high frequency and low time resolution at low frequencies and a low frequency and high time resolution at high frequencies. Here the STFT is not the most useful and the wavelet transform can provide a better description.