Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

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

Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 2
Registered: 11/13/13
atan2 (-360 to 360) Joint angle calculations.
Posted: Nov 13, 2013 6:03 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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

A1=[x1, y1];

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

% Trigonometry Calculations
Opp1= C1-B1;
pheta1= atan2(Opp1(:,1),Adj1(:,2));

% 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.

Thanks in advance!

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2015. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.