Skip to content

Instantly share code, notes, and snippets.

@mattgaidica
Last active December 30, 2021 14:19
Show Gist options
  • Save mattgaidica/1d18747efa1953e44395796a9077fc6a to your computer and use it in GitHub Desktop.
Save mattgaidica/1d18747efa1953e44395796a9077fc6a to your computer and use it in GitHub Desktop.
% Hargens et al. (1985) Figure 2 Recreation
xs = 30:10:70;
fitxs = 0:100;
% backed out from plot
loadCenter = [49,40,33,20,10];
loadErrorUpper = [50.5,42.5,38,25,12.5];
tensionCenter = [50,57,66,78,85];
tensionErrorUpper = [55,59,70,83,88];
fs = 16;
lw = 2;
close all;
figure('position',[0,0,450,350]);
set(gcf,'color','w');
errorbar(xs,loadCenter,(loadErrorUpper-loadCenter),'o-','color','k','linewidth',lw);
set(gca,'fontsize',fs);
ylabel({'Load on Forelimbs','(% of body weight)'});
ylim([0,100]);
yticks(0:20:100);
p = polyfit(xs,loadCenter,1);
text(25,10,sprintf("Load = %1.2fx + %1.2f",p(1),p(2)),'fontsize',fs);
hold on;
plot(fitxs,p(1)*fitxs+p(2),'k:');
yyaxis right;
errorbar(xs,tensionCenter,(tensionErrorUpper-tensionCenter),'o-','color','r','linewidth',lw);
set(gca,'ycolor','r');
ylabel({'Tension on Tail','(% of body weight)'});
ylim([0,100]);
yticks(0:20:100);
p = polyfit(xs,tensionCenter,1);
text(25,90,sprintf("Tension = %1.2fx + %1.2f",p(1),p(2)),'fontsize',fs,'color','r');
hold on;
plot(fitxs,p(1)*fitxs+p(2),'r:');
grid on;
xlim([20,80]);
xticks(20:10:80);
xlabel('Angle of Head-down Tilt (degrees)');
set(gca,'fontsize',fs);
saveas(gcf,'HUloadTension.png');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment