How to make equation work for each frame of data?

2 vues (au cours des 30 derniers jours)
Amanda
Amanda le 28 Fév 2023
Commenté : William Rose le 1 Mar 2023
Hey guys! I have walking data that I am trying to calculate joint angles for. The data I have has two colums of 134 rows that I need the equations to calculate for each frame of data. I do not know how to do this. I assume I'll need some for of a loop to do so.
  2 commentaires
David Hill
David Hill le 28 Fév 2023
What is the equation?

Connectez-vous pour commenter.

Réponse acceptée

William Rose
William Rose le 28 Fév 2023
Modifié(e) : William Rose le 28 Fév 2023
[edit: correct error in my code]
This looks like something I would have assigned when I taught biomechanics or when I taught a graduate course in advanced biomechanics.
You have sagital plane data for right hip, knee, ankle, foot. You do not need a for loop. Matlab is good at avoiding the need for for loops.
What happens when you run your code? Do you get an error? What is it?
You did not supply the csv file. You only supplied the PDF, which is not useful.
It looks like you are not using the necessary syntax for indexing the matrices. Let's assume the following code works (which I cannot verify, since I don't have the CSV file):
data = readmatrix('2D_kinematics_2022.csv'); %read data from file
RGRT = data(:,1:2); %x,y for R greater trochanter
RLCO = data(:,3:4); %x,y for R knee lateral epicondyle
Compute the angle of the thigh vector relative to horizontal:
thighAngle=atan2(RLCO(:,2)-RGRT(:,2),RLCO(:,1)-RGRT(:,1));
Try it and apply that idea to the other angles, including joint angles.
  2 commentaires
Jan
Jan le 1 Mar 2023
Modifié(e) : Jan le 1 Mar 2023
@Amanda: You find the same solution in your other thread: https://www.mathworks.com/matlabcentral/answers/1919840-how-to-create-a-vector-for-multiple-frames-of-data-in-rows-and-columns#comment_2638220 . This is the drawback of duplicate questions: The answering persons waste time for posting solutions repeatedly. Please avoid this in the future.
William Rose
William Rose le 1 Mar 2023
@Jan, thank you.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by