View Single Post
  #34 (permalink)  
Old 03-15-2010, 07:02 PM
agraham's Avatar
agraham agraham is offline
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

You missed attaching the attachment

Quote:
Originally Posted by klaus View Post
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.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.

Last edited by agraham : 03-15-2010 at 07:19 PM.
Reply With Quote