function [x]=Elastic2sec4(k,dx,Ef)
  x=0;
  E=0;
  while E<=Ef
    x=x+dx;
    E=E+k*x*dx;
  end
  %Ea=1/2*k*xf^2;
  %Error=E-Ea;
end
