Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Creating Vectors and Finding the angle

Subject: Creating Vectors and Finding the angle

From: Peter

Date: 7 Nov, 2011 15:54:11

Message: 1 of 9

Im using motion analysis to determine the angle of the arm during an activity. I have the (x,y,z) coordinates of the shoulder, elbow and wrist. How can i turn these into vectors and determine the angle?

Subject: Creating Vectors and Finding the angle

From: Richard Crozier

Date: 7 Nov, 2011 15:58:14

Message: 2 of 9

"Peter" wrote in message <j98uv3$9f4$1@newscl01ah.mathworks.com>...
> Im using motion analysis to determine the angle of the arm during an activity. I have the (x,y,z) coordinates of the shoulder, elbow and wrist. How can i turn these into vectors and determine the angle?

Angle relative to what?

To turn them into vectors, read the file they are stored in into Matlab. They will then be a list of vectors stored in a matrix.

Subject: Creating Vectors and Finding the angle

From: Peter

Date: 7 Nov, 2011 16:02:31

Message: 3 of 9

Im trying to find the angle that is formed between the upper arm and forearm.

Subject: Creating Vectors and Finding the angle

From: Richard Crozier

Date: 7 Nov, 2011 16:08:13

Message: 4 of 9

"Peter" wrote in message <j98vem$bdm$1@newscl01ah.mathworks.com>...
> Im trying to find the angle that is formed between the upper arm and forearm.

No problem then, if you just write out the few vector equations to do this it will be very easy to implement in Matlab. If you write out the equations, and where you're having trouble, I'm sure someone here will help you implement them.

Subject: Creating Vectors and Finding the angle

From: Roger Stafford

Date: 7 Nov, 2011 21:55:28

Message: 5 of 9

"Peter" wrote in message <j98uv3$9f4$1@newscl01ah.mathworks.com>...
> Im using motion analysis to determine the angle of the arm during an activity. I have the (x,y,z) coordinates of the shoulder, elbow and wrist. How can i turn these into vectors and determine the angle?
- - - - - - - - -
  If vs, ve, and vw are the x,y,z coordinate vectors for the shoulder, elbow, and wrist, respectively, then the angle (in radians) between the upper arm and the lower arm will be:

 a = atan2(cross(vw-ve,ve-vs),dot(vw-ve,ve-vs));

Roger Stafford

Subject: Creating Vectors and Finding the angle

From: Roger Stafford

Date: 7 Nov, 2011 22:20:29

Message: 6 of 9

"Roger Stafford" wrote in message <j99k4g$pji$1@newscl01ah.mathworks.com>...
> a = atan2(cross(vw-ve,ve-vs),dot(vw-ve,ve-vs));
- - - - - - - -
  My previous reply was in error. The angle between the two parts of the arm is:

 a = atan2(abs(cross(vw-ve,vs-ve)),dot(vw-ve,vs-ve));

It should range between 0 and pi, 0 for an arm completely bent and pi for a straight arm.

Roger Stafford

Subject: Creating Vectors and Finding the angle

From: Roger Stafford

Date: 8 Nov, 2011 09:12:12

Message: 7 of 9

"Roger Stafford" wrote in message <j99ljd$1as$1@newscl01ah.mathworks.com>...
> a = atan2(abs(cross(vw-ve,vs-ve)),dot(vw-ve,vs-ve));
- - - - - - - - -
  My apologies. I made another error. I was thinking of the two-dimensional case. The answer should have been:

 a = atan2(norm(cross(vw-ve,vs-ve)),dot(vw-ve,vs-ve));

Roger Stafford

Subject: Creating Vectors and Finding the angle

From: Peter

Date: 9 Nov, 2011 19:19:31

Message: 8 of 9

when you mean vs,ve and vw you mean the coordinates opf each point?

Subject: Creating Vectors and Finding the angle

From: Peter

Date: 9 Nov, 2011 19:26:13

Message: 9 of 9

My apoligies, i failed to read all of the previous posts, when i do that i get a=# # #
where # is a number

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us