An easy example of STFT

T Miyamoto
Sep 30, 2021

--

Suppose we have an image of a wave:

This wave is inverse transformed to one in the frequency coordinates. To do so, use short time fourier transform. Here we use method signal.stft from scipy:

from scipy import signal 

f0, t0, Zxx=signal.stft(original_wave, fs=1 )

where fs is the sampling frequency. Then plot it

ax.plot(f0, Zxx, lw=2.5)

It can easily be noticed that there are two major “peaks” in the frequency coordinates. Assuming that these two have physical meanings, we segment these two peaks. And then we conduct inverse short time fourier transform.

So we can see that the original wave actually consists of two different waves and that stft helps us to extract the ingredients of a complex wave.

--

--