function [Force_Coeffs] = AccumSpringForce(gamma)

var = load('calforcoefsaug11run007.txt');

var1 = var(:,1);
var2 = var(:,2);

A = pi*2.5^2/4-pi*1.75^2/4;
F = 400:3000;

D = [58 231/2 231];
P = F/A;
I = [P(1) 150 620];
%I = [P(1) 150 550];

Vol_tot = zeros(1,length(P));
for i = 1:length(D)
Vol_tot = Vol_tot+Vol(P,I(i),D(i),gamma);
end

Force_Coeffs = interp1(var1/39.37,4.45*var2,'linear','pp');
%Force_Coeffs = interp1(0.0254*Vol_tot/A,4.45*F,'linear','pp');  %In terms of newtons and meters

L = [0:.2:72];
figure('Position', [100 100 1000 800])
set(gcf,'color','white');
plot(L,ppval(Force_Coeffs,L*0.0254)/4.45);
set(gca,'FontName','times','FontSize', 16);
xlabel('Stroke(inches)','FontName','times','FontSize', 16)
ylabel('Force (lbf)','FontName','times','FontSize', 16)
%grid on
end


function Vol = Vol(P,I,D,gamma)

Vol = zeros(1,length(P));
for i = 1:length(P)
  if(P(i) > I)
    Vol(i) = D-I^(1/gamma)*D/(P(i)^(1/gamma));  
  else
    Vol(i) = 0;
  end
end

end
