Calculate 3D angles?

조회 수: 6 (최근 30일)
mlsnyder08
mlsnyder08 2017년 3월 30일
답변: Ryan Plucinski 2019년 2월 14일
I have a 40x12 matrix in MatLab. The first three columns represent the (x,y,z) coordinates of the hip, columns 4-6 represent the (x,y,z) coordinates of the knee, and columns 7-9 represent the (x,y,z) coordinates of the ankle. I want to calculate the angle formed between the hip-knee and knee-angle segment.
I know that I can simply use Pythagorean theorem for x,y,z to get the lengths and then use acos to get the angle, but I'd like to do it in a more advanced way with vectors!!!
1) How can I turn certain rows and columns of data from my big matrix into a vector?
2) How can I use those vectors (hip-knee and knee-ankle) to calculate a 3D angle?
Thank you so much!

답변 (2개)

KSSV
KSSV 2017년 3월 30일
  댓글 수: 1
mlsnyder08
mlsnyder08 2017년 3월 31일
Thank you for the link. I saw that question before but wanted to know how to selectively choose certain rows and columns from my big matrix with which to populate the vector. At that point, I will be able to use the answer from the link you provided.

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


Ryan Plucinski
Ryan Plucinski 2019년 2월 14일
1). you can do this in numerous ways, depending on how you want you vector to be.
ex: this code takes the first 3 hip coordinates and seperates them to a different vector, HipX, HipY, and HipZ respectively
%data=excel file of 40x12
data=xlsread('excelfile.xls');
HipX=excelfile(:,1);
HipY=excelfile(:,2);
HipZ=excelfile(:,3);

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by