You missed attaching the attachment
Quote:
Originally Posted by klaus
The Tan function should be the ATan2 function
|
It
does use the .NET Math.Atan2 function. It is the same Atan2 function as Basic4ppc uses so the problem must be elsewhere.
ph[i] = Math.Atan2(imag[i], real[i]) * DegPerRad;
In the docs Atan2 is specified as the return value is the angle in the Cartesian plane formed by the x-axis, and a vector starting from the origin, (0,0), and terminating at the point, (x,y). It is an angle, θ, measured in radians, such that -π≤θ≤π, and tan(θ) = y / x, where (x, y) is a point in the Cartesian plane. Observe the following:
For (x, y) in quadrant 1, 0 < θ < π/2.
For (x, y) in quadrant 2, π/2 < θ≤π.
For (x, y) in quadrant 3, -π < θ < -π/2.
For (x, y) in quadrant 4, -π/2 < θ < 0.
Quote:
|
Shouldn't we open a new thread for the FFT library ?
|
I was waiting till we were happy with it and then I was going to do a help before starting a new library thread for it.
EDIT:- Commenting out 'FFTPhase(i)=ATan2(FFTImag(i),FFTReal(i))*RadDeg in the For loop in CalcFFT in your previous example and inserting
FFTPhase() = Fft.ToPhase(FFTReal(), FFTImag()) after the Next looks OK for me. Did you get the order of the parameters of ToPhase correct? I see your graph if I reverse them.