Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. %get outputs of function at poses 1-5 respectivly
  2. [aFNx, aFjx, aFjy, aFm] = BiomechanicsP1(90, 180, 57, 129, 2, 100, 10);
  3. [bFNx, bFjx, bFjy, bFm] = BiomechanicsP1(78, 145, 39, 131, 2, 100, 10);
  4. [cFNx, cFjx, cFjy, cFm] = BiomechanicsP1(72, 100, 28, 116, 2, 100, 10);
  5. [dFNx, dFjx, dFjy, dFm] = BiomechanicsP1(66, 87, 31, 61, 2, 100, 10);
  6. [eFNx, eFjx, eFjy, eFm] = BiomechanicsP1(72, 37, 25, 63, 2, 100, 10);
  7.  
  8. %Find magnitude of Fj for each pose
  9. aFj = norm(aFjx, aFjy);
  10. bFj = norm(bFjx, bFjy);
  11. cFj = norm(cFjx, cFjy);
  12. dFj = norm(dFjx, dFjy);
  13. eFj = norm(eFjx, eFjy);
  14.  
  15. %create matrices for x and y axes for each graphed value
  16. plotx = [180 145 100 87 37];
  17. plotFjx = [aFjx bFjx cFjx dFjx eFjx];
  18. plotFjy = [aFjy bFjy cFjy dFjy eFjy];
  19. plotFj = [aFj bFj cFj dFj eFj];
  20. plotFm = [aFm bFm cFm dFm eFm];
  21.  
  22. %polyfit for Fjx
  23. pFjx = polyfit(plotx,plotFjx,3); %3rd degree polynomial
  24. fxFjx = linspace(0,180,180);
  25. fyFjx = polyval(pFjx,fxFjx);
  26.  
  27. %polyfit for Fjy
  28. pFjy = polyfit(plotx,plotFjy,3); %3rd degree polynomial
  29. fxFjy = linspace(0,180,180);
  30. fyFjy = polyval(pFjy,fxFjy);
  31.  
  32. %polyfit for Fj
  33. pFj = polyfit(plotx,plotFj,3); %3rd degree polynomial
  34. fxFj = linspace(0,180,180);
  35. fyFj = polyval(pFj,fxFj);
  36.  
  37. %polyfit for Fm
  38. pFm = polyfit(plotx,plotFm,3); %3rd degree polynomial
  39. fxFm = linspace(0,180,180);
  40. fyFm = polyval(pFm,fxFm);
  41.  
  42. %%plots
  43. %plot Fjx
  44. subplot(2, 2, 1);
  45. scatter(plotx, plotFjx);
  46. hold on;
  47. plot(fxFjx,fyFjx)
  48. title('Fjx');
  49. xlabel('Posterior angle between leg and thigh');
  50. ylabel('Force in Newtons');
  51.  
  52. %plot Fjy
  53. subplot(2, 2, 2);
  54. scatter(plotx, plotFjy);
  55. hold on;
  56. plot(fxFjy,fyFjy)
  57. title('Fjy');
  58. xlabel('Posterior angle between leg and thigh');
  59. ylabel('Force in Newtons');
  60.  
  61. %plot Fj
  62. subplot(2, 2, 3);
  63. scatter(plotx, plotFj);
  64. hold on;
  65. plot(fxFj,fyFj)
  66. title('Magnitude of Fj');
  67. xlabel('Posterior angle between leg and thigh');
  68. ylabel('Force in Newtons');
  69.  
  70. %plot Fm
  71. subplot(2, 2, 4);
  72. scatter(plotx, plotFm);
  73. hold on;
  74. plot(fxFm,fyFm)
  75. title('Fm');
  76. xlabel('Posterior angle between leg and thigh');
  77. ylabel('Force in Newtons');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement