Hi,
I'm having trouble to understand what's going on with my FFT. Given a number of sinusoidal points, I need to fit them into a sine function. That is, I need to know A, B, C and D from y = A·sin(B·t+C)+D.
The way I intended to do it was by performing the FFT -> D (the offset) would be the amplitude at 0 Hz, B the frequency where the FFT amplitude is maximum, so I can also know A at that point.
I use C# (.NET) together with the Exocortex.DSP.v1 library. I did my own graphic library. You can download the .exe from here ->
http://openelectronicdesigns.com/files/public/myFFT.zip[
^].
This is just a program to show my problem. I generate a time signal, then calculate the FFT, and represent the complex number in the Complex plot. As you can see when you uncheck the "FFT Windowing" and set the frequency to 10 (10 cycles over 1024 points), you can change the phase, and the phasor at the Complex plot changes according to it. The phase is correct in that case.
Here the problem comes. If you change the frequency, let's say at 10.25Hz, the phase also changes, and that's what I don't understand. I can only calculate the phase when I have a complete number of cycles inside the 1024 points of the FFT. Initially I thought it was because of the discontinuity from the last to the initial point, and that's why I added the FFT Windowing option. But it makes no major difference...
Anyone could please tell me what am I doing wrong? I think it might be a conceptual problem rather than a programmatic one, but there are lots of intelligent people around here ;)
Thank you!