system_prop.m

Objective-C source code icon system_prop.m — Objective-C source code, 3 kB (3096 bytes)

File contents

%% System Properties (Ref: winter, Biomechanics and Motor control of human body (chap1-anatomy.pdf)
function[P]=system_prop
global L K c Delta delta tf

P.M    = 85;                                    % Total human body mass(kg)
P.H    = 1.75;                                  % Human Height(m)


m1     = (2*0.161)*P.M;                         % Total leg mass 0.161*m is for one leg
m2     = 0.678*P.M;                             % HAT mass
L1     = 0.53*P.H;                              % Total leg length                             
L2     = (0.818-0.53)*P.H;                      % Height from hip to the shoulder
Lc1    = (1-0.447)*L1;
Lc2    = 0.626*L2;
J1     = m1*(0.326*L1)^2;                       % Moment of Inertia with respect to center of mass
J2     = m2*(0.496*L2)^2;

%% System Properties

P.L1  = L1;                                     % Length of first link
P.L2  = L2;                                     % Length of second link
P.l1  = Lc1;                                    % Distance from joint center to center of mass for first link
P.l2  = Lc2;                                    % Distance from joint center to center of mass for second link


P.m1  = m1;                                     % Mass of first link
P.m2  = m2;                                     % Mass of second link

P.J1  = J1;                                     % Moment of Inertia of first link
P.J2  = J2;                                     % Moment of Inertia of first link
P.g   = 9.8;                                    % Gravity accelaration



%% Coefficients

% Equations of motion coeffs
C.h1 = P.m1+P.m2;
C.h2 = P.m1*P.l1+P.m2*P.L1;
C.h3 = P.m2*P.l2;
C.h4 = P.J1+P.m2*P.L1^2+P.m1*P.l1^2;
C.h5 = P.m2*P.l2*P.L1;
C.h6 = P.J2+P.m2*P.l2^2;
C.h7 = (P.m1*P.l1+P.m2*P.L1)*P.g;
C.h8 = P.m2*P.l2*P.g;

% Linearlized coeffs of equations of motion

C.a = C.h6*C.h4-C.h5^2;
C.b = C.h6*C.h7;
C.c = -C.h5*C.h8;
C.d = -C.h6*C.h2+C.h5*C.h3;
C.e = C.h5*C.h7;
C.f = -C.h4*C.h8;
C.g = -C.h5*C.h2+C.h3*C.h4;

HH=[C.h6/C.a -C.h5/C.a;
    -C.h5/C.a C.h4/C.a];

QQ=[C.b/C.a C.c/C.a;
    -C.e/C.a -C.f/C.a];

%% Linearlized Equation of motions in Matrix form (x_d=A*X+B*u+W*a)

P.A = [  0         1        0         0;
       C.b/C.a     0      C.c/C.a     0;
         0         0        0         1;
       -C.e/C.a    0      -C.f/C.a    0];


P.B = [  0                  0;
      C.h6/C.a         -C.h5/C.a;
        0                  0;
    - C.h5/C.a          C.h4/C.a];
 

P.K = [950  185  175   50
        45   60  290   26];
    
P.W = [  0;
     C.d/C.a;
        0;
    -C.g/C.a];

%% Stochastic solver (Euler-Maruyama Method) parameters
          
tf    = 100;                    % Time duration
Delta = 2^(-11);                % Euler-Maruyama timestep
delta = Delta;                  % Brownian path has timestep delta
c     = 0.5;                    % coefficent of dW2 and dW3 (controller noise)


L     =  tf/Delta;              % Number of steps for Euler-Maruyama method
K     =  Delta/delta;