Facebook
From lR, 2 Days ago, written in GNU Octave M-file.
Embed
Download Paste or View Raw
Hits: 64
  1. syms Rx Ry Rz T1 T2 T3 N W1 W2 k1 k2 k3 H W n1 n2 n3 b1 b2 b3 s1 s2 s3 xM1 yM1 zM1 xM2 yM2 zM2 xM3 yM3 zM3 xA yA zA xB yB zB xC yC zC xD yD zD real
  2.  
  3. %Positions:
  4. %%Position of limb joints
  5. rA=[xA yA zA]';
  6. rB=[xB yB zB]';
  7. rD=[xD yD zD]';
  8.  
  9. rC1=(rA+rB)/2;
  10. rC1=(rB+rD)/2;
  11.  
  12. %%Position of muscles application:
  13. rM1 = [xM1 yM1 zM1]';
  14. rM2 = [xM2 yM2 zM2]';
  15. rM3 = [xM3 yM3 zM3]';
  16.  
  17. %Forces
  18.  
  19. %%Known
  20.  
  21. W1v = [sym(0) sym(0) -k1*W]';
  22. W2v = [sym(0) sym(0) -k2*W]';
  23. Nv = [sym(0) sym(0) k3*W]';
  24.  
  25. %Unknown
  26. Rv=[Rx Ry Rz]';
  27. T1v = T1*[n1 n2 n3]';
  28. T2v = T2*[b1 b2 b3]';
  29. T3v = T3*[s1 s2 s3]';
  30.  
  31.  
  32. %Equilibrium eqs
  33. %%Sum of all forces
  34. SRv=Rv+W1v+W2v+Nv+T1v+T2v+T3v;
  35. %%Sum of all moments
  36. SMv=cross(rM1, T1v)+cross(rM2, T2v)+cross(rM3, T3v)+cross(rC1, W1v)+cross(rC2, W2v)+cross(rD, Nv);
  37.  
  38. %%Projections
  39. eq1 = dot(SRv, [1;0;0]')==0;
  40. eq2 = dot(SRv, [0;1;0]')==0;
  41. eq3 = dot(SRv, [0;0;1]')==0;
  42. eq4 = dot(SMv, [1;0;0]')==0;
  43. eq5 = dot(SMv, [0;1;0]')==0;
  44. eq6 = dot(SMv, [0;0;1]')==0;
  45.  
  46. eqs = [eq1 eq2 eq3 eq4 eq5 eq6]; vars = [Rx Ry Rz T1 T2 T3];
  47.  
  48. [Rxs Rys Rzs T1s T2s T3s] = solve(eqs, vars);
  49.  
  50. simplify([Rxs Rys Rzs T1s T2s T3s])
  51.  
  52. %symbolic_values_data = [k1 k2 k3 H W n1 n2 n3 b1 b2 b3 s1 s2 s3 xM1 yM1 zM1 xM2 yM2 zM2 xM3 yM3 zM3 xA yA zA xB yB zB xC yC zC xD yD zD];
  53. %numeric_values_data = []
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.