Problems with angles between two 3D vector!

Hi everybody!
I'm analysing data coming from an optoelectronic system which records body movements. I record positions of markers during time and I have to calculate angles like shoulder rotation, elbow flexion/extension, ecc. I'm able to do this using this formula:
ThetaInDegrees = atan2d(norm(cross(u,v)),dot(u,v));
where u and v are two 3D vectors. The movement that I perform is like a sinewave so it goes up and then down several times.
The problem is that sometimes(I don't understand well when) the atan2d formula gives me only crescent values of angles and it seems like the sinewave is rectified, as in the picture below:
How can I manage this problem in order to have a normal sinusoid??
Thanks so much!!

댓글 수: 2

Jan
Jan 2019년 5월 31일
Without seeing your input data and known, what you exactly expect, all I want to mention is that atan2d works exactly as expected. So if there is a problem, it must be found in your 3D model or in the import of the data.
Think twice: With seeing the code line for a trigonometric formula only, it is impossible to estimate, why the results differ from your expectations.
Sorry.
My code is:
for i= 2:length(data_res)
FA_inst = [(Elbow2(i,1)-Cent_wrist(i,1)) (Elbow2(i,2)-Cent_wrist(i,2)) (Elbow2(i,3)-Cent_wrist(i,3))];
hand_inst = [(Index(i,1)-Med_wrist(i,1)) (Index(i,2)-Med_wrist(i,2)) (Index(i,3)-Med_wrist(i,3))];
wrist_flexo_extention_angle(i) = 180- atan2d(norm(cross(FA_inst, hand_inst)),dot(FA_inst, hand_inst));
end
where FA_inst is the instantaneus vector that identifis the forearm while hand_inst is the vector that identify the hand. The wrist flexio/extension is the angle I need.
I wolud like that, as it is indicated in the figure below:
wrist.JPG
when the hand bends in the sense of the blue arrow the angle measured is positive, while when it goes towards the red arrow's direction, the measured angle is negative.
It is possible with some other formulas?
Thanks so much Jan!!

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

질문:

2019년 5월 30일

댓글:

2019년 5월 31일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by