Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
angle function not giving right phase

Subject: angle function not giving right phase

From: b_palit@rediffmail.com (Biswaroop Palit)

Date: 10 Oct, 2004 12:14:12

Message: 1 of 1

Heres the output for the initial query
I think it is a prob with the early versions
Biswaroop


temp =[
    0.0000 -0.0000 - 4.0000i 1.4142 + 1.4142i -0.0000 +
0.0000i -0.0000 -0.0000 - 0.0000i 1.4142 - 1.4142i -0.0000 +
4.0000i]

temp =

  Columns 1 through 7
  0 0 - 4.0000i 1.4142 + 1.4142i 0 0 0
1.4142 - 1.4142i

  Column 8

        0 + 4.0000i

>> angle (temp)

ans =

   0 -1.5708 0.7854 0 0 0 -0.7854 1.5708


On Sat, 09 Oct 2004 23:18:56 -0700, trying_to_learn wrote:
>trying_to_learn wrote:
>> temp contains an 8 point fft .it has complex numbers.
>> >>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 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
?
>>
>> thanks
>
>I tried the following and got...
>
> >> angle ([(-0.0000 - 0.0000i) ,( -0.0000 + 0.0000i ),(-0.0000)])
>
>ans =
>
> 3.1416 0 3.1416
>
>then i tried:
>
> >> angle ((-0.0000 - 0.0000i))
>
>ans =
>
> 0
>
> >> angle(-0.0000)
>
>ans =
>
> 0
>
>So its odd that matlab gives 2 different answers .
>1) it returned phase of (-0.0000 - 0.0000i) as 3.1416, when (-0.0000
-
>0.0000i) was an element in an array , but it returned phase as 0 when

>(-0.0000 - 0.0000i) was independant argument of angle function .
>
>it did the same for -0.0000 as argument to angle function
>why does matlab have this inconsistency?!!?

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us