Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.80 KB | None | 0 0
  1. function [Fjx,Fjy, Fm] = BioMP1(aa, ak, aw, as, H, M, mobj)
  2. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3. %Function file: BioMP1.m
  4. %Purpose:
  5. % To determine location of the normal force for a person in a certain
  6. % pose with a certain mass and the joint forces on the hip along with the
  7. % force of the muscle erector spinae
  8. % All angle inputs are interior
  9. %Record of revisions (Date | Programmer | Change):
  10. % 2/15/20| Andrew Bodney | Original program
  11. %Main Variables:
  12. %INPUTS:
  13. % aa -angle at ankle in degrees
  14. % ak -angle at knee in degrees
  15. % ah -angle at hips in degrees
  16. % as -angle at shoulder in degrees
  17. % H -height of person in meters
  18. % M -mass of person in kilograms
  19. % mobj -mass of object in kilograms
  20. %OUTPUTS:
  21. % Fjx -Joint force on hip in x-direction
  22. % Fjy -Joint force on hip in y-direction
  23. % Fm -Force of muscle erector spinae
  24. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  25. %initial
  26. %origin is toes
  27. g = 9.81; %gravity
  28. %object position in meters
  29. x = 0.25;
  30. y = 0.5;
  31. %angles from degrees to radians
  32. aground = 180*pi/180;
  33. aankle = aa*pi/180;
  34. aknee = ak*pi/180;
  35. awaist = aw*pi/180;
  36. ashoulder = as*pi/180;
  37. %lengths of body parts
  38. lfeet = (0.152)*H;
  39. hfeet = (0.039)*H;
  40. llegs = (0.285-0.039)*H;
  41. lthighs = 0.245*H;
  42. ltnh = (0.818-0.53)*H;
  43. lua = 0.186*H;
  44. lfah = (0.145+0.108/2)*H;
  45. %masses of body parts
  46. mfeet = 0.0145*2*M;
  47. mlegs = 0.0465*2*M;
  48. mthighs = 0.1*2*M;
  49. mtnh = 0.578*M;
  50. mua = 0.028*2*M;
  51. mfah = 0.022*2*M;
  52. msum = mfeet+mlegs+mthighs+mtnh+mua+mfah+mobj;
  53. %Weight matrix
  54. Wmfeet = [0; -mfeet*g; 0];
  55. Wmlegs = [0; -mlegs*g; 0];
  56. Wmthighs = [0; -mthighs*g; 0];
  57. Wmtnh = [0; -mtnh*g; 0];
  58. Wmua = [0; -mua*g; 0];
  59. Wmfah = [0; -mfah*g; 0];
  60. Wmsum = [0; -msum*g; 0];
  61. %Weight as a force in y-direction
  62. Wfeet = mfeet*g;
  63. Wlegs = mlegs*g;
  64. Wthighs = mthighs*g;
  65. Wtnh = mtnh*g;
  66. Wua = mua*g;
  67. Wfah = mfah*g;
  68. Wsum = msum*g;
  69. %center of gravity of body parts
  70. cgfeet = 0.095*H;
  71. cglegs = 0.139*H;
  72. cgthighs = 0.139*H;
  73. %swap from distal to proximal measuring after hip
  74. cgtnh = 0.190*H;
  75. cgua = 0.081*H;
  76. cgfah = 0.099*H;
  77. cgobj = x;
  78. %Normal force
  79. FN = [0; Wsum; 0];
  80. rFN = [-0.5*0.152*H 0 0];
  81. %Location of Normal force on the feet
  82. lN = (Wfeet*cgfeet + Wlegs*cglegs + Wthighs*cgthighs + Wtnh*cgtnh + Wua*cgua + Wfah*cgfah + mobj*g*cgobj)./FN;
  83. %Set up for the rotation matrices
  84. Rground = [cos(aground) -sin(aground) 0 0; sin(aground) cos(aground) 0 0; 0 0 1 0; 0 0 0 1];
  85. Rankle = [cos(aankle) -sin(aankle) 0 0; sin(aankle) cos(aankle) 0 0; 0 0 1 0; 0 0 0 1];
  86. Rknee = [cos(aknee) -sin(aknee) 0 0; sin(aknee) cos(aknee) 0 0; 0 0 1 0; 0 0 0 1];
  87. Rwaist = [cos(awaist) -sin(awaist) 0 0; sin(awaist) cos(awaist) 0 0; 0 0 1 0; 0 0 0 1];
  88. Rshoulder = [cos(ashoulder) -sin(ashoulder) 0 0; sin(ashoulder) cos(ashoulder) 0 0; 0 0 1 0; 0 0 0 1];
  89. %Set up for the lengths as matrices
  90. Lfeet = [1 0 0 lfeet; 0 1 0 -hfeet; 0 0 1 0; 0 0 0 1];
  91. Llegs = [1 0 0 llegs; 0 1 0 0; 0 0 1 0; 0 0 0 1];
  92. Lthighs = [1 0 0 lthighs; 0 1 0 0; 0 0 1 0; 0 0 0 1];
  93. Ltnh = [1 0 0 ltnh; 0 1 0 0; 0 0 1 0; 0 0 0 1];
  94. Lua = [1 0 0 lua; 0 1 0 0; 0 0 1 0; 0 0 0 1];
  95. Lfah = [1 0 0 lfah; 0 1 0 0; 0 0 1 0; 0 0 0 1];
  96. %Create secondary link matrices for the distance to the CG on each link
  97. Lfeetcg = [1 0 0 cgfeet; 0 1 0 0; 0 0 1 0; 0 0 0 1];
  98. Llegscg = [1 0 0 cglegs; 0 1 0 0; 0 0 1 0; 0 0 0 1];
  99. Lthighscg = [1 0 0 cgthighs; 0 1 0 0; 0 0 1 0; 0 0 0 1];
  100. Ltnhcg = [1 0 0 cgtnh; 0 1 0 0; 0 0 1 0; 0 0 0 1];
  101. Luacg = [1 0 0 cgua; 0 1 0 0; 0 0 1 0; 0 0 0 1];
  102. Lfahcg = [1 0 0 cgfah; 0 1 0 0; 0 0 1 0; 0 0 0 1];
  103. %Displacement of x-value for each segment
  104. Tfeet = (Rground * Lfeet);
  105. Tlegs = (Rground*Lfeet*Rankle*Llegs);
  106. Tthighs = (Rground*Lfeet*Rankle*Llegs*Rknee*Lthighs);
  107. Ttnh = (Rground*Lfeet*Rankle*Llegs*Rknee*Lthighs*Rwaist*Ltnh);
  108. Tua = (Rground*Lfeet*Rankle*Llegs*Rknee*Lthighs*Rwaist*Ltnh*Rshoulder*Lua);
  109. Tfah = (Rground*Lfeet*Rankle*Llegs*Rknee*Lthighs*Rwaist*Ltnh*Rshoulder*Lua*Lfah);
  110. Tobj = (Rground*Lfeet*Rankle*Llegs*Rknee*Lthighs*Rwaist*Ltnh*Rshoulder*Lua*Lfah);
  111. %Calculate the x-value of displacement for each CG
  112. Tfeetcg = (Rground * Lfeetcg);
  113. Tlegscg = (Rground*Lfeet*Rankle*Llegscg);
  114. Tthighscg = (Rground*Lfeet*Rankle*Llegs*Rknee*Lthighscg);
  115. Ttnhcg = (Rground*Lfeet*Rankle*Llegs*Rknee*Lthighs*Rwaist*Ltnhcg);
  116. Tuacg = (Rground*Lfeet*Rankle*Llegs*Rknee*Lthighs*Rwaist*Ltnh*Rshoulder*Luacg);
  117. Tfahcg = (Rground*Lfeet*Rankle*Llegs*Rknee*Lthighs*Rwaist*Ltnh*Rshoulder*Lua*Lfahcg);
  118. Tobj = (Rground*Lfeet*Rankle*Llegs*Rknee*Lthighs*Rwaist*Ltnh*Rshoulder*Lua*Lfah);
  119. %Define vectors from the origin (where we will take the moments) to the CGs and the object.
  120. rfeetcg = [Tfeetcg(1, 4), Tfeetcg(2, 4), 0];
  121. rlegscg = [Tlegscg(1, 4), Tlegscg(2, 4), 0];
  122. rthighscg = [Tthighscg(1, 4), Tthighscg(2, 4), 0];
  123. rtnhcg = [Ttnhcg(1, 4), Ttnhcg(2, 4), 0];
  124. ruacg = [Tuacg(1, 4), Tuacg(2, 4), 0];
  125. rfahcg = [Tfahcg(1, 4), Tfahcg(2, 4), 0];
  126. robj = [Tobj(1, 4), Tobj(2, 4), 0];
  127. %Define unit vectors
  128. Lesp = [1 0 0 0; 0 1 0 0.05*ltnh; 0 0 1 0; 0 0 0 1];
  129. Lesd = [1 0 0 0.8*ltnh; 0 1 0 0; 0 0 1 0; 0 0 0 1];
  130. Tesp = (Rground*Lfeet*Rankle*Llegs*Rknee*Lthighs*Rwaist*Lesp);
  131. Tesd = (Rground*Lfeet*Rankle*Llegs*Rknee*Lthighs*Rwaist*Lesd);
  132. %now move to the spine
  133. %Swapped definition of proximal and distal as we move away from the hips
  134. Fmdir = [Tesd(1,4)-Tesp(1,4) Tesd(2,4)- Tesp(2,4) 0];
  135. Fmdir = Fmdir/norm(Fmdir);
  136. rFm = [Tesp(1,4) Tesp(2,4) 0];
  137. rthighs = [Tthighscg(1,4) Tthighscg(2,4) 0];
  138. msum = (cross(rfeetcg,Wmfeet)+cross(rlegscg,Wmlegs)+cross(rthighscg,Wmthighs)+cross(rFN,FN)); msum = msum(3);
  139. RHS = [0; mfeet*g+mlegs*g+mthighs*g-(M+mobj)*g; -msum];
  140. Fmmom = cross(rFm, Fmdir);
  141. LHS = [1 0 Fmdir(1); 0 1 Fmdir(2); -rthighs(2) rthighs(1) Fmmom(3)];
  142. soln = inv(LHS)*RHS;
  143. Fjx = soln([1]);
  144. Fjy = soln([2]);
  145. Fm = soln([3]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement