Closed markjlorenz closed 10 years ago
go-dsp is working correctly. That FFT site is just zero padding (which is fine) the fft output. Both that FFT site and go-dsp are giving the same result (the big peaks at the edge). Use this octave script to verify for yourself:
t = 0:0.00001:2/1000;
s = sin(2*pi*t);
f = fft(s);
a = abs(f);
plot(a)
You are (of course) correct. Thank you for pointing that out!
I'm sure this is my fault, but I can't see what I'm doing wrong.
Given the following simple program, when the input is a 440Hz sine wave, I expect to see a single peak in the frequency domain. Giving the same input to an online FFT calculator, the expected output is obtained.
Can you point out my mistake, or is
go-dsp
doing something strange?The Program
It's run like:
The Input
Data is here, it's 440Hz sine. Plotted it looks like:![screen shot 2014-03-09 at 3 53 19 pm](https://f.cloud.github.com/assets/193421/2368970/1e84cf62-a7c6-11e3-87ed-fa7cd912f602.png)
The Output
Data is here. Plotted it looks like:![screen shot 2014-03-09 at 3 54 35 pm](https://f.cloud.github.com/assets/193421/2368972/31e45906-a7c6-11e3-9b0f-9ab64f84e798.png)
The x-scale here isn't Hz, it's just the bin numbers from
FFTReal
.Expected Output
Using the same input, and the online FFT mentioned above, I get the expected output:![screen shot 2014-03-09 at 3 54 54 pm](https://f.cloud.github.com/assets/193421/2368975/50b4df0e-a7c6-11e3-954a-1d1c4eb9e6f5.png)