Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Re: atan2 angles

$
0
0
"Fran" wrote in message <kk7bjk$7hl$1@newscl01ah.mathworks.com>...
> given a vector from (0,0) to a point on a y-x axis (y pointing North, and x pointing to the East)...
>
> calculate the angle between the positive Y axis and the vector.
> 1) I would like that if the vector lies on the positive Y i get 0 degrees.
> 2) The angle should increase as it goes ANTICLOCKWISE
> 3) I can only have values from 0-360 degrees.
- - - - - - - -
  If I've understood you correctly, it would be this:

 a = 180/pi*mod(atan2(y,x)-pi/2,2*pi);

For example, if the vector points midway between south and east then 'a' would be 225 degrees, that is, a 225 degree swing counterclockwise from north down to southeast.

Roger Stafford

Viewing all articles
Browse latest Browse all 19628

Trending Articles