ThetaGround function
Created Matlab function utilised by the main Manifold Variance code (MatlabUCMVariance.txt) to calculate the angle of the foot to the ground during stance phase


__________________________________________________
function [thGTIME]=thetaGround(inputfile1)
%Calculate the angle of the foot to the ground


ANG = csvread(inputfile1);
iGL = [1 0 0];% define x axes versor (a)
HEEL= ANG(:,4:5);
TOE= ANG(:,6:7);
bTIME = zeros(100,2);
vpTIME = zeros(100,1);
thGTIME = zeros(100,1);


for i=1:100
    %calculation of foot to ground angle
    C(1,:) = HEEL(i,:)/1000; %calacaneus
    Cx=C(1,1);
    Cy=C(1,2);
    M(1,:) = TOE(i,:)/1000;%Mid Foot
    Mx = M(1,1);
    My = M(1,2);
    b= (M-C)./norm(M-C);
    bTIME(i,:) = b;
    b= [b(1,1) b(1,2) 0];
    vp = cross(iGL,b); % vector product between a and b
    vpTIME(i,1)= vp(1,3);
    thG = asin(vp(1,3)); %angle to the ground of the foot 
    thGTIME(i,:) = thG;   
   
end
end


