Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %get outputs of function at poses 1-5 respectivly
- [aFNx, aFjx, aFjy, aFm] = BiomechanicsP1(90, 180, 57, 129, 2, 100, 10);
- [bFNx, bFjx, bFjy, bFm] = BiomechanicsP1(78, 145, 39, 131, 2, 100, 10);
- [cFNx, cFjx, cFjy, cFm] = BiomechanicsP1(72, 100, 28, 116, 2, 100, 10);
- [dFNx, dFjx, dFjy, dFm] = BiomechanicsP1(66, 87, 31, 61, 2, 100, 10);
- [eFNx, eFjx, eFjy, eFm] = BiomechanicsP1(72, 37, 25, 63, 2, 100, 10);
- %Find magnitude of Fj for each pose
- aFj = norm(aFjx, aFjy);
- bFj = norm(bFjx, bFjy);
- cFj = norm(cFjx, cFjy);
- dFj = norm(dFjx, dFjy);
- eFj = norm(eFjx, eFjy);
- %create matrices for x and y axes for each graphed value
- plotx = [180 145 100 87 37];
- plotFjx = [aFjx bFjx cFjx dFjx eFjx];
- plotFjy = [aFjy bFjy cFjy dFjy eFjy];
- plotFj = [aFj bFj cFj dFj eFj];
- plotFm = [aFm bFm cFm dFm eFm];
- %polyfit for Fjx
- pFjx = polyfit(plotx,plotFjx,3); %3rd degree polynomial
- fxFjx = linspace(0,180,180);
- fyFjx = polyval(pFjx,fxFjx);
- %polyfit for Fjy
- pFjy = polyfit(plotx,plotFjy,3); %3rd degree polynomial
- fxFjy = linspace(0,180,180);
- fyFjy = polyval(pFjy,fxFjy);
- %polyfit for Fj
- pFj = polyfit(plotx,plotFj,3); %3rd degree polynomial
- fxFj = linspace(0,180,180);
- fyFj = polyval(pFj,fxFj);
- %polyfit for Fm
- pFm = polyfit(plotx,plotFm,3); %3rd degree polynomial
- fxFm = linspace(0,180,180);
- fyFm = polyval(pFm,fxFm);
- %%plots
- %plot Fjx
- subplot(2, 2, 1);
- scatter(plotx, plotFjx);
- hold on;
- plot(fxFjx,fyFjx)
- title('Fjx');
- xlabel('Posterior angle between leg and thigh');
- ylabel('Force in Newtons');
- %plot Fjy
- subplot(2, 2, 2);
- scatter(plotx, plotFjy);
- hold on;
- plot(fxFjy,fyFjy)
- title('Fjy');
- xlabel('Posterior angle between leg and thigh');
- ylabel('Force in Newtons');
- %plot Fj
- subplot(2, 2, 3);
- scatter(plotx, plotFj);
- hold on;
- plot(fxFj,fyFj)
- title('Magnitude of Fj');
- xlabel('Posterior angle between leg and thigh');
- ylabel('Force in Newtons');
- %plot Fm
- subplot(2, 2, 4);
- scatter(plotx, plotFm);
- hold on;
- plot(fxFm,fyFm)
- title('Fm');
- xlabel('Posterior angle between leg and thigh');
- ylabel('Force in Newtons');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement