MATLAB returning zero fiber lengths
Posted: Thu Jul 16, 2015 7:40 am
Hi,
I've been working on some code to calculate Normalized Fiber Lengths throughout a walking cycle. I've been able to set up the model to run through the motion by updating the coordinates, but whenever I call either the fiber length or normalized fiber length, a value of zero is always returned. Here's the loop that updates the coordinates:
data is matrix that contains all of the coordinates and their values for each time
And when I call for the lengths this is an example of what I get:
>> myMuscle
myMuscle =
addbrev_r
>> myMuscle.getNormalizedFiberLength(s)
ans =
0
>> myMuscle.getFiberLength(s)
ans =
0
If I allow the code to run it will fill up the entire matrix with zeros for all of the muscles. I know the fiber length data is in the model; I can plot it using the GUI. Did I accidentally skip over a setting as I was writing the code?
Thanks,
Colton
EDIT: From just the initial state, I was able to return normalized fiber lengths for muscles in the torso (of which I am not concerned). These muscles are fixed because I am using the pelvis as the origin in a lower body model. Does the fact that I am changing the coordinates mean that the fiber length is lost?
I've been working on some code to calculate Normalized Fiber Lengths throughout a walking cycle. I've been able to set up the model to run through the motion by updating the coordinates, but whenever I call either the fiber length or normalized fiber length, a value of zero is always returned. Here's the loop that updates the coordinates:
data is matrix that contains all of the coordinates and their values for each time
Code: Select all
s = myModel.initSystem();
for ii = 1:myModel.getMuscles().getSize
myForce = myModel.getMuscles().get(ii - 1);
myMuscle = Muscle.safeDownCast(myForce);
display(char(myMuscle));
for k = 1: nFrames
for j = 1:15
updCoord = myModel.updCoordinateSet.get(j-1);
updCoord.setValue(s, data(k,j)/180*2/pi);
updCoord.setSpeedValue(s,0);
end
storageData(k,:) = myMuscle.getFiberLength(s);
end
end
>> myMuscle
myMuscle =
addbrev_r
>> myMuscle.getNormalizedFiberLength(s)
ans =
0
>> myMuscle.getFiberLength(s)
ans =
0
If I allow the code to run it will fill up the entire matrix with zeros for all of the muscles. I know the fiber length data is in the model; I can plot it using the GUI. Did I accidentally skip over a setting as I was writing the code?
Thanks,
Colton
EDIT: From just the initial state, I was able to return normalized fiber lengths for muscles in the torso (of which I am not concerned). These muscles are fixed because I am using the pelvis as the origin in a lower body model. Does the fact that I am changing the coordinates mean that the fiber length is lost?