Please tell me what's wrong here with the exp (1j*theta)
12 views (last 30 days)
Show older comments
I am trying to find the theta part from an exponential value.
Suppose, i take a variable
z=exp(1i*5);
so this will give me
z =
0.2837 - 0.9589i
Now i want to find that "5" from this value. So, i go with this "angle(z)" and matlab shows
ans =
-1.2832
Shouldn't it be 5, according to theory ??
Or if i go with the eular formula like, exp(i*theta)= cos(theta) + i*sin(theta)
so, theta= atan(0.2837/-0.9589) = -0.2877 !!
How do i get the theta=5 back, i don't know if i am missing something.
0 Comments
Accepted Answer
John Doe
on 11 May 2013
Edited: John Doe
on 11 May 2013
The reason is that:
5 rad = -1.2832 rad % (-1.2832 + 2*pi = 5)
That is:
x = x + n*2*pi; % where x is an angle in radians, and n is an integer.
Matlab will always give you values between +/- pi.
And you use Eular the wrong way around: tan = sin/cos, not cos/sin.
=)
- Rob
6 Comments
John Doe
on 11 May 2013
No. Valid angles are in the area (-pi < x < pi). Since 4 and 5 are outside this area, the angles are not 4 and 5 (but -1.283.. etc). However, 1 and 2 are within the valid area, thus the angle is equal to 1 and 2 (without adding any +/-k*2*pi).
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!