Determine knee angle from xyz coordinates of hip, knee, and ankle.

Hello, i am struggling with MATLAB code. I have data matrix of coordinates of hip, knee, and ankle and need to take this to calculate angle of the knee. I got an answer for angle, however it is only 1x1 of one angle. I am trying to find each angle of the coordinates with respect to time so i can later plot them. Any suggestion? should be 1x100 angles with respect to each coordinate. Do i need some sort of for loop ?
angledata=xlsread('Plucinskilab2coordinates.xlsx')
% resize data to 100 rows
[c,d]=size(angledata);
normalizedata=resample(angledata,100,c);
p1x=normalizeangle(:,10);
p2x=normalizeangle(:,13);
p3x=normalizeangle(:,16);
p1y=normalizeangle(:,11);
p2y=normalizeangle(:,14);
p3y=normalizeangle(:,17);
a=((p1x)-(p2x));((p1y)-(p2y));
b=((p1x)-(p3x));((p1y)-(p3y));
CosTheta= dot(a,b)/(norm(a)*norm(b));
ThetaInDegreesKnee = acosd(Costheta);

Answers (0)

Categories

Find more on Just for fun in Help Center and File Exchange

Tags

Asked:

on 13 Feb 2019

Community Treasure Hunt

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

Start Hunting!