evaluating SHORT TIME FOURIER TRANSFORM of a stationary signal
Updated 9 Nov 2008
the stationary signal
f(t)=cos(2*pi*5*t)+ cos(2*pi*10*t)+ cos(2*pi*20*t)+ cos(2*pi*50*t)
having frequencies of 5,10, 20and 50 Hz at any given time instant.
MATLAB program can be implemented to plot the stationary signal mentioned above:
/*sampling frequency (fs)=200hz
/*The same signal if is non-stationary in nature,i.e its frequency changes with time, from 5,10,20 to 50 hz.one frequency exists at a time.The non-stationary signal can be produced using the following MATLAB program:*/
The similarity between is that both of them show four spectral components at exactly the same frequencies, i.e., at 5,10, 20, 50.Other than the ripples, and the difference in amplitude (which can always be normalized), the two spectrums are almost identical, although the corresponding time-domain signals are not even close to each other. Both of the signals involve the same frequency components, but the first one has these frequencies at all times, the second one has these frequencies at different intervals. As the FT gives the spectral content of the signal, but it gives no information regarding where in time those spectral components appear . Therefore, FT is not a suitable technique for non-stationary signal.
In STFT, the signal is divided into small enough segments, where these segments (portions) of the signal can be assumed to be stationary. For this purpose, a window function "w" is chosen. The width of this window must be equal to the segment of the signal where its stationarity is valid.
This window function is first located to the very beginning of the signal. That is, the window function is located at t=0. Let's suppose that the width of the window is "T" s. At this time instant (t=0), the window function will overlap with the first T/2 seconds (I will assume that all time units are in seconds). The window function and the signal are then multiplied. By doing this, only the first T/2 seconds of the signal is being chosen, with the appropriate weighting of the window (if the window is a rectangle, with amplitude "1", then the product will be equal to the signal). Then this product is assumed to be just another signal, whose FT is to be taken. In other words, FT of this product is taken, just as taking the FT of any signal.
The result of this transformation is the FT of the first T/2 seconds of the signal. If this portion of the signal is stationary, as it is assumed, then there will be no problem and the obtained result will be a true frequency representation of the first T/2 seconds of the signal.
The next step, would be shifting this window (for some t1 seconds) to a new location, multiplying with the signal, and taking the FT of the product. This procedure is followed, until the end of the signal is reached by shifting the window with "t1" seconds intervals.
The following definition of the STFT summarizes all the above explanations in one line:
STFT(T,X)=INTEGRATION [ x(t) * w(t-t') * exp(-j*2*pi*f*t) ] dt
Taking the previous example of the nonstationary signal whose frequency increases from
5,10,20 to 50 hz, we evaluate the STFT of that signal taking rectangular window of length 50,and shifting it for 1 unit each time,resulting into a highly overlapping window.
Thus we get the 3D plot of STFT of the signal.Amplitude-Frequency-Time curve.
payel mukherjee (2023). evaluating SHORT TIME FOURIER TRANSFORM of a stationary signal (https://www.mathworks.com/matlabcentral/fileexchange/22033-evaluating-short-time-fourier-transform-of-a-stationary-signal), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
- Signal Processing > Signal Processing Toolbox > Transforms, Correlation, and Modeling > Transforms > Discrete Fourier and Cosine Transforms > Short-Time Fourier Transform >
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.