I am working on gait analysis and I want to find joint angles of hip,knee and ankle.The only information I have is the markers position(x,y,z coordinates).Any help will be appreciated .
I'll suggest that you are working in sagittal plan. So in order to determine the angles of ankle and knee and hip you need (x,y) position of ankle, hip and knee. Then using inverse kinematics you can determine theses angles very easily.
You asked how to calculate lower extremity kinematics using 3d coordinates. If you want hip I/E rotations, shank I/E rotations, Vaurus/valgus , and foot inversion/evertion as well you want 3d Angles.
The suggestion for inverse kinematics is mostly used in robotics where you know where the end effector is and you want to know what angles of arm segments would be to end up with the end effector in a certain position. In your case the end effector is the foot. The solution given by Vijay is only 2d (I assume you want 3d) and it only provides two angles – the angle between the thigh and the horizontal (not really hip flexion) and the angle between the thigh and shank (knee angle). Inverse kinematics can yield different solutions.
The cosign formula from Mustafa will work but it gives the absolute 3d angle between two vectors and if the vectors are not in the same plane this angle is not necessarily the same as the clinical joint angle you want – maybe not a problem if hip and shank are in same plane – but like for the upper arm movements relative to the trunk it is problematic.
The preferred method used by most motion capture systems is to calculate the Euler Angles based on the local coordinate frames for each segment. Too much to explain here, but you should look up Euler angle calculation which you can do or get matlab or even excel programs to do. There are some caveat’s with them, but you can also reference several authors as well as ISB recommendations for their calculations
Compute a mid point of each joint x, y and z coordinates (left and right joint), then use these points in angle calculations. From this calculation, each calculated point for each frame is so smooth and easy in readability.