close all
clear all

l = 0.125;  %pitch (inches)
dm = 0.375;  %Mean diameter (inches)

F = 100:100:4000;  %Force (lbs)

%Blall

%Trn = 0.5*F*dm*(l+pi*mu*dm)/(pi*dm-mu*l);
%eta = F*l./(2*pi*Trn);

tanphi = l/(pi*dm);
phi = atan(tanphi);

rhopp = 0.34*pi/180;  %friction angle

eta = tanphi/tan(phi+rhopp);
etap = 0.95*eta;  %Derate to give "practical efficiency"
Trn = F*l*etap/(2*pi);






V = 0:.1:3;
w = 2*pi*V/l;



figure('PaperType','usletter','PaperPositionMode','manual','PaperPosition',[.75,.75,8.5-.75,11-.75])

h1 = subplot('Position',[.1 .54 .8 .4]);
h2 = subplot('Position',[.1 .04 .8 .4]);

subplot(h1)
plot(F,Trn);
xlabel('Force (lbs)');
ylabel('Torque (in-lbs)');
text(.05,.9,['Efficiency = ',num2str(etap,'%3.2f')],'Units','normalized');
title(['Screw Diameter = ',num2str(dm,'%3.2f'),'in.   Lead = ',num2str(l,'%4.3f'),'in']);


subplot(h2)
plot(V,w*60/(2*pi));
xlabel('Linear Speed (in/s)');
ylabel('Rotary Speed (rpm)');


print -depsc2 BallScrewEfficiency.eps