DSPRelated.com
Forums

angle funtion doesnt give right phase angles

Started by doodoo902102002 October 9, 2004


temp contains an 8 point fft.
>>temp = fft(x,num_pts)
temp =
Columns 1 through 5

0.0000 -0.0000 - 4.0000i 1.4142 + 1.4142i -0.0000 +
0.0000i -0.0000

Columns 6 through 8

-0.0000 - 0.0000i 1.4142 - 1.4142i -0.0000 + 4.0000i

>>angle_fft = angle(temp)

angle_fft =

0 -1.5708 0.7854 1.5965 3.1416 -1.5965 -0.7854 1.5708 Qn) the 3 phase angles ( 1.5965 , 3.1416, -1.5965 ) should
actually be equal to zero, since the corresponding temp elements are
(-0.0000 + 0.0000i , -0.0000 , -0.0000 - 0.0000i ) , why is
the angle function returning ( 1.5965 , 3.1416, -1.5965 )
instead of 0 ?
How to fix this.
thanks

thanks




Mr. DooDoo 90210-

> temp contains an 8 point fft.
> >>temp = fft(x,num_pts)

What's in temp you've printed. What's in num_pnts?

> temp =
> Columns 1 through 5
>
> 0.0000 -0.0000 - 4.0000i 1.4142 + 1.4142i -0.0000 +
> 0.0000i -0.0000
>
> Columns 6 through 8
>
> -0.0000 - 0.0000i 1.4142 - 1.4142i -0.0000 + 4.0000i
>
> >>angle_fft = angle(temp)
>
> angle_fft =
>
> 0 -1.5708 0.7854 1.5965 3.1416 -1.5965 -0.7854 1.5708
>
> Qn) the 3 phase angles ( 1.5965 , 3.1416, -1.5965 ) should
> actually be equal to zero, since the corresponding temp elements are
> (-0.0000 + 0.0000i , -0.0000 , -0.0000 - 0.0000i ) , why is
> the angle function returning ( 1.5965 , 3.1416, -1.5965 )
> instead of 0 ?
> How to fix this.

A "negative zero" looks interesting. If you print that to more precision, my
guess
is that you find some very small value there. In which case arctan(-small
value/zero) would be pi/2.

-Jeff