short time fourier transform
6 views (last 30 days)
I would like to perform a short time fourier transform (STFT) to a synthetic data series. I can compute the fourier transform by:
fs = 40;
t = 0:(1 / fs):4;
y1 = [sin(2 * pi * 5 * t(t <= 2)), sin(2 * pi * 10 * t(t > 2))];
Fy1 = abs(ifft(y1));
N = numel(t);
idx = 1:numel(Fy1) / 2; % # Indices of half the spectrum
f = fs * (0:(N - 1)) / N; % # Actual frequencies
As a third subplot, I would now like to compute the STFT otherwise known as the windowed fourier transform, which will show hoe the frequency of the signal varies in time. How can this be done?
Why not just use spectrogram if you have the Signal Processing Toolbox?
You can output the STFT and/or the short-time periodograms (PSD estimates)
Then just use the 'yaxis' option
t = 0:0.001:1-0.001;
If you actually output arguments from spectrogram, you have much more control over the plot. See the help.