I might be going crazy here. Following my question: here
I did some thinking and probably understood that my STFT algorithm was not performing correctly.
I followed this algorithm:
-> Get 256 of data
-> Apply windowing function
-> Get the FFT
-> get the first 128 points
Here is my result. I have used NFFT = 256
which should give me 128
points. I firstly calculated the FFT (after the windowing function was applied) and only counted the first 128
values of this. I.e. FFT_RESULT / 2
Whereas my last output was the following:
I don't quite understand why the values along the X axis
are particular that high?
EDIT:
Ok, so following the advice, I did the following:
1) Created a 2D vector for each of the "256 resulting FFT values"
for(size_t i=0; (i < signal.size()); i++)
{
std::vector<double> temp_vector;
// store blocks of 256 inside temp_vector
// Compute Hanning Window
// Compute FFT
std::vector<std::vector<complex> stft;
stft.push_back(temp_vector);
}
This gave me a total of 74 blocks within the 2D vector.
I then took the absolute value of the REAL values and stored these inside a double, read these in and with pylab
library I used imshow()
and got the following result:
However, If I plot normally, I get the following:
I think my calculations are correct, I just don't think I'm plotting them right using the spectrogram!!
72x256
I took, the signal, split it into blocks of 256 and took them windows. I did not skip any samples at all, to take the next window.. I'm guessing this is wrong? $\endgroup$