Biomechanics Gait Study in MATLAB
Contributor: Shriyaa Srihari
Contributor: Shriyaa Srihari
Understanding the forces and moments developed at the joints while walking is very useful information as this can be used in many biomechanical applications. This data is often used in improving athletic performance, reducing the risk of injury, and evaluating the performance of assistive technology. The goal of this project was to determine the reaction forces and moments at the ankle, knee, and hip during the stance phase of gait using a rigid-link model and inverse dynamics.
Information regarding the position of the center of mass (COM), the ground reaction force (GRF), the position of center of pressure (COP), the mass (m), and mass moment of inertia (I) were determined using the motion capture lab in Bray. A combination of data from 12 VICON cameras, a force plate, and anthropometric charts were used to find this information. The 12 VICON cameras and a force plate were used to record the movement of a subject who had 13 markers attached to them at various points on their body, which included both the upper body joints and leg joints. The subject was also directed to begin walking at a specific point that resulted in the right foot of the subject to land on the force plate. The marker data was recorded at 100 Hz while the force plate data was recorded at 1000 Hz. The anthropometric table was used, along with the motion capture information, to determine the mass and the mass moment of inertia. All of this data was processed using MATLAB to find the appropriate information from the experiment.
Reaction forces and moments at the joints were evaluated using a rigid-body model of the leg, where the foot, shank, and thigh were treated as rigid segments connected by joints at the ankle, knee, and hip. Free-body diagrams were used to derive equations of motion based on assumed force directions at each joint. These equations were implemented in a MATLAB script using given motion capture and force plate data to determine the reaction forces and torque developed at each joint at an instant in the gait. To analyze these values over time, a for loop was used to iterate through the dataset frame by frame, to generate time graphs of force and torque throughout the gait.
% foot data
foot_m = 0.86; % kg
foot_i = 0.0037; % kg*m^2
foot_ax = foot_COM_la(:,1); % m/s^2
foot_az = foot_COM_la(:,2); % m/s^2
foot_rot_a = foot_aa; % rad/s^2
foot_grfx = GRF(:,1); % N
foot_grfz = GRF(:,2); % N
% shank data
shank_m = 2.73; % kg
shank_i = 0.0237; % kg*m^2
shank_ax = shank_COM_la(:,1); % m/s^2
shank_az = shank_COM_la(:,2); % m/s^2
shank_rot_a = shank_aa; % rad/s^2
% thigh data
thigh_m = 8.92; % kg
thigh_i = 0.1903; % kg*m^2
thigh_ax = thigh_COM_la(:,1); % m/s^2
thigh_az = thigh_COM_la(:,2); % m/s^2
thigh_rot_a = thigh_aa; % rad/s^2
% position data (in meters)
ankle_x = RANKLE(:,1);
ankle_z = RANKLE(:,1);
g_foot_x = foot_COM(:,1);
g_foot_z = foot_COM(:,2);
cop_x = COP(:,1);
cop_z = COP(:,2);
knee_x = RKNEE(:,1);
knee_z = RKNEE(:,2);
g_shank_x = shank_COM(:,1);
g_shank_z = shank_COM(:,2);
hip_x = RTROCH(:,1);
hip_z = RTROCH(:,2);
g_thigh_x = thigh_COM(:,1);
g_thigh_z = thigh_COM(:,2);
% preallocated lists
ax = [];
ay = [];
ma = [];
kx = [];
ky = [];
mk = [];
hx = [];
hy = [];
mh = [];
% for loop for calculations
for i = 1:79
ax(i) = -(foot_m*foot_ax(i)) + foot_grfx(i); % N
ay(i) = (-9.81*foot_m) + foot_grfz(i) - (foot_m*foot_az(i)); % N
ma(i) = (ay(i)*(g_foot_x(i)-ankle_x(i))) + (ax(i)*(ankle_z(i)-g_foot_z(i))) + (foot_grfx(i)*(g_foot_z(i)-cop_z(i))) - (foot_i*foot_rot_a(i)) + (foot_grfz(i)*(cop_x(i)-g_foot_x(i))); % N*m
% knee force equations
kx(i) = ax(i) - (shank_m*shank_ax(i)); % N
ky(i) = ay(i) - (shank_m*9.81) - (shank_m*shank_az(i)); % N
mk(i) = ma(i) + (ax(i)*(g_shank_z(i)-ankle_z(i)))-(ay(i)*(g_shank_x(i)-ankle_x(i)))-(ky(i)*(knee_x(i)-g_shank_x(i)))+(kx(i)*(knee_z(i)-g_shank_z(i)))-(shank_i*shank_rot_a(i)); % N*m
% hip force equations
hx(i) = kx(i) - (thigh_m*thigh_ax(i)); % N
hy(i) = ky(i)-(thigh_m*thigh_az(i))-(thigh_m*9.81); % N
mh(i) = mk(i) + (kx(i)*(g_thigh_z(i)-knee_z(i)))-(ky(i)*(g_thigh_x(i)-knee_x(i)))+(hx(i)*(hip_z(i)-g_thigh_z(i)))-(hy(i)*(hip_x(i)-g_thigh_x(i)))-(thigh_i*thigh_rot_a(i)); % N*m
end;
% graphing
time = linspace(0.1, 0.79, 79)
figure;
hold on;
plot(time, ax, 'green');
plot(time, ay, 'blue');
xlabel('Time (secs)');
ylabel('Reaction Forces (N) and Torque (N*m)');
title('Graph of Ankle Reaction Forces and Torques');
legend('Ax (N)', 'Ay (N)', 'Ma (N*m)', 'Location', 'best');
grid on;
hold off;
figure;
hold on;
plot(time, hx, 'green');
plot(time, hy, 'blue');
xlabel('Time (secs)');
ylabel('Reaction Forces (N)');
title('Graph of Hip Reaction Forces and Torques');
legend('Hx', 'Hy', 'Location', 'best');
grid on;
hold off;
figure;
hold on;
plot(time, kx, 'green');
plot(time, ky, 'blue');
xlabel('Time (secs)');
ylabel('Reaction Forces (N)');
title('Graph of Knee Reaction Forces');
legend('Kx', 'Ky', 'Location', 'best');
grid on;
hold off;
figure;
hold on;
plot(time, ma, 'green');
plot(time, mh, 'blue');
plot(time, mk, 'cyan');
xlabel('Time (secs)');
ylabel('Torque (N*m)');
title('Graph of Torques');
legend('Ma', 'Mh', 'Mk', 'Location', 'best');
grid on;
hold off;
Fig. 1 - Graph of Time Versus Torque for the Ankle, Knee, and Hip
Fig. 2 - Graph of Time Versus Force for the Knee
Fig. 3 - Graph of Time Versus Force for the Hip
Fig. 4 - Graph of Time Versus Force for the Ankle
Figure 1 show the joint torques experienced at the hip, knee, and ankle as the participant walked across the force plate. Figures 2 through 3 show the joint reaction forces experienced during the stance phase, displaying the horizontal and vertical force components as the participant progresses over the force plate.
The ankle has the largest magnitude for the z-reaction force as it is closest to the ground. Its proximity affects the way the leg receives the z-reaction force. Since it is the first major joint to receive the vertical ground reaction force from the foot contact, it absorbs the initial impact forces when the heel strikes and pushes off the ground while walking. Along with this, since the ankle is the first joint that receives the force, all of the ground reaction force in the z-direction must pass from the ankle before it can be distributed to the knee and hip joints. This drastically reduces the z-reaction force that the other joints must absorb. Lastly, the ankle acts as leverage when propelling the body forward as it generates a strong plantarflexion force. This adds to the vertical GRF, which in turn increases the magnitude of the z-reaction force at the ankle.
The large peak of the ankle moment during terminal stance represents a phase in the gait cycle during which the body is supported by a single limb. This takes place from the moment the foot is lifted off the ground until the opposite foot makes contact with the ground. The large magnitude of the force is due to the force required to propel the body forward. The peak appears positive since the sign conventions in this project defined the moment about the ankle to be clockwise and the body requires a counterclockwise moment to move from the back foot to the forward foot.
During the terminal stance in walking, the hip joint experiences a large peak of the hip moment as the hip flexors stretch to control and slow down the backward extension of the leg. As the body continues to move forward, the trailing leg extends behind and the hip flexors generate a flexion motion to slow down this movement and prepare for the leg to swing next. This movement is considered positive because a forward moment at the hip is defined as positive.
The moment peaks of the hip and ankle reaction force graphs show that the ankle experiences a greater vertical force than the hip whereas the hip experiences a greater horizontal force than the ankle. The ankle experiences greater vertical forces because it is the first joint to receive the ground reaction forces during foot contact, while the hip experiences greater horizontal forces due to its role in stabilizing and propelling the body forward during the gait.
The first and second extrema of the knee moment represent key phases of muscle activity around the knee joint. The first extrema occurs during the loading response of the early stance, where the ground reaction force creates a moment about the knee. To balance this, the quads generate an internal extension moment, which results in a positive net joint moment. The second extrema occurs during the late stance, when the knee begins to flex to initiate swing. Here the internal flexion of the hamstrings produces a negative joint moment. These extrema show how the external forces and internal muscle moments balance each other out to maintain joint stability to facilitate controlled walking.
A slight variation was noted between our free body diagrams and the references provided for Parts A and B of the project. While the magnitudes of our computed reaction forces matched the reference values, the signs were reversed. We determined this to be due to our diagrams which depicted reaction forces and torques in the opposite directions compared to those in the reference. This directional difference carried over into the MATLAB generated graphs, causing them to appear inverted relative to the reference. This outcome reflects a difference in sign conventions used in the equation of motion rather than an error.