Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: atan2 (-360 to 360) Joint angle calculations.
Replies: 5   Last Post: Nov 19, 2013 12:33 PM

 Messages: [ Previous | Next ]
 Alice Posts: 2 Registered: 11/13/13
atan2 (-360 to 360) Joint angle calculations.
Posted: Nov 13, 2013 6:03 AM

I am trying to calculate 2D joint angles using basic trig.

A1=[x1, y1];
B1=[x2,y2];

% Determining the coordinates of the 3rd point (to create a triangle)
C1 = [x1,y2];

% Trigonometry Calculations
Opp1= C1-B1;

% convert degrees
pheta1= pheta1*(180/pi);

However, after using the formula above I am finding, where participants extend their shoulder >180, it flips round to a minus value. I understand this to be due to my use of atan2.

However I am unable to use a simple if pheta1< 0, pheta1=pheta1+360, end. Because there are some values <0 that are correct/true, and not the result of flipping.

I have tried;
* pheta1=mod(360+pheta1,360);
* pheta1=rem(360+pheta1,360);
and various versions of unwrap, currently with no luck.

If anyone has any suggestions, they would be very welcomed.