If z is a vector , what is the difference between angle(z) and atan2(z)
2 views (last 30 days)
Hassan Abdelazeem on 12 Jan 2022
If z is a vector z=x+j*y, what is the difference between angle(z) and atan2(z)
becuae when I used angle(x+i*.y) gives a differen results
this is the matlab code
t=zeros(N,1); Bmx=zeros(N,1); Bmy=zeros(N,1);
P1 = atan2(Bmy,Bmx);
John D'Errico on 12 Jan 2022
Edited: John D'Errico on 12 Jan 2022
Perhaps you did not use atan2 properly. Consider this example:
z = [1+i,1-i,-1+i,-1-i];
If you want the result in degrees, this is not difficult. In fact, with atan2d, it already does the conversion for you to degrees.
The two functions will be compatible, as long as you use them properly. remember that atan2 is a TWO argument utility. You need to separate out the real and imaginary parts to use atan2 or atan2d.