This question is based on a previous similar question.
I have the following equation and an adjusted (some random data): 0.44*sin(N* 2*PI/30)
I am trying to use the FFT to get the frequency from the data generated. However the frequency ends up being close but not equal to the frequency (which makes the wave a bit larger than intended)
The frequencies that are at the maximum for the FFT is 7hz, however the expected frequency is (30/2PI) 4.77hz.
I've included a graph of the FFT and plotted values.
The code I am using is:
[sampleFFTValues sFreq] = positiveFFT(sampledata, 1);
sampleFFTValues = abs(sampleFFTValues);
[v sFFTV]= max(sampleFFTValues)
Positive FFT can be found here. Basically it centers the FFT graph and cuts off the negative signals.
My question is how can I get the FFT to be more accurate without having to resort to least squares for just the frequency?