 | | From: | attackack at yahoo.com | | Subject: | FFT phase errors | | Date: | 18 Jan 2005 10:01:32 -0800 |
|
|
 | I've a c++ code about FFT and when i calculate the phase parameters i see some errors. In a PDF file about FFT i've seen that:
''...this error occurs whenever the real part is negative. This problem can be corrected by testing the real and imaginary parts after the phase has been calculated. If both the real and imaginary parts are negative, subtract 180=B0 (or PI radians) from the calculated phase. If the real part is negative and the imaginary part is positive, add 180=B0(or PI radians). Drill this into your mind. You have to see the phase only extending to =B11.5708. The smallest possible value is always chosen, keeping the phase between -PI and PI. It is often easier to understand the phase if it does not have these discontinuities, even if it means that the phase extends above PI, or below -PI. This is called unwrapping the phase. ..=2E...........''
Now i ask...there is a code that calculate the phase correctly whit all the different options? P=2ES.: naturally i have real and imaginary component by FFT.
|
|
 | | From: | James Van Buskirk | | Subject: | Re: FFT phase errors | | Date: | Wed, 19 Jan 2005 02:09:39 -0700 |
|
|
 | wrote in message news:1106071292.385110.129580@f14g2000cwb.googlegroups.com...
[snip]
Let z = x+j*y.
You want atan2(y,x).
-- write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, & 6.0134700243160014d-154/),(/'x'/)); end
|
|
 | | From: | glen herrmannsfeldt | | Subject: | Re: FFT phase errors | | Date: | Tue, 18 Jan 2005 10:44:17 -0800 |
|
|
 | attackack@yahoo.com wrote:
> I've a c++ code about FFT and when i calculate the phase parameters i > see some errors. In a PDF file about FFT i've seen that:
(snip)
> Now i ask...there is a code that calculate the phase correctly whit all > the different options? > P.S.: naturally i have real and imaginary component by FFT.
It is called atan2() in both Fortran and C. I believe in C++ also.
-- glen
|
|