Biomech-Sim-Toolbox 1
Toolbox for movement simulation and analysis
|
Matlab script documenting the use of the MEX function gait2dc.mex32. More...
Matlab script documenting the use of the MEX function gait2dc.mex32.
This file documents the use of the MEX function gait2dc.mex32. The musculoskeletal model is documented in the file gait2dc_reference. The MEX function can be used to perform several functions with the model.
Label | Description |
---|---|
Ndof | Number of kinematic degrees of freedom (is 9 for this model) |
Nmuscles | Number of muscles (16) |
Ncontacts | Number of contact points defined in the XLS file |
Nstates | Number of state variables: 2*Ndof * 2*Nmuscles + 4*Ncontacts |
NRstick | Number of right side stick figure points: 5 + Ncontacts (trunk, hip, Rknee, Rankle, Right contact points, and Rankle again) |
NLstick | Number of left side stick figure points: 4 + Ncontacts (hip, Lknee, Lankle, Left contact points, and Lankle again) |
The MEX function can be used in several ways.
This initializes the model with a set of parameters. This is required before anything is done with the model. The par
matrix can be obtained by reading an Excel file. The Excel file also contains labels to facilitate human reading and editing.
par | Matrix with model parameters, formatted using gait2dc_par.xls |
xneutral | Model state vector (Nstates x 1) for a neutral state where the model is in free fall with feet not quite touching the ground, but otherwise close to static equilibrium. |
Implicit differential equation for 2D musculoskeletal model : f(x,dx/dt,u,M) = 0
x | State of the model (Nstates x 1) |
xdot | State derivatives (Nstates x 1) |
u | Neural excitations for the muscles (Nmuscles x 1) |
M | (optional) Extra joint moments (Njoints x 1), for instance from prosthetic device |
f | Dynamic residuals (Nstates x 1), wil be zero when inputs satisfy system dynamics |
dfdx | (optional) Jacobian matrix df/dx (Nstates x Nstates) |
dfdxdot | (optional) Jacobian matrix df/dxdot (Nstates x Nstates) |
dfdu | (optional) Jacobian matrix df/du (Nstates x Nmuscles) |
dfdM | (optional) Jacobian matrix df/dM (Nstates x Njoints) |
The last four outputs are optional and some computation time is saved if you do not request all of them.
This returns the ground reaction forces for the system in state x
grf | 6 x 1 matrix, Right Fx,Fy,Mz Left Fx,Fy,Mz |
dgrfdx | (optional) 6 x Nstates matrix, derivatives of grf with respect to state x |
This returns data for a stick figure, for the system in state x
right | NL x 2 matrix, containing x and y coordinates for right side stick figure |
left | NR x 2 matrix, containing x and y coordinates for left side stick figure |
rfoot | [optional] NRf x 2 matrix, x and y coordinates of the right foot without deformation |
lfoot | [optional] NLf x 2 matrix, x and y coordinates of the left foot without deformation |
This returns muscle forces, for the system in state x
forces | 16 x 1 column vector with muscle forces (N), in same order as muscle table in gait2d_par.xls |
dFdx | 16 x 66 matrix with the derivates of the muscle |