function d = findTubeDiameter(t,dmax,P,Leff,E,Sy)
% findTubeDiameter  iameter of round tube that does not buckle under an applied load
%
% Synopsis:  d = findTubeDiameter(t,dmax,P,Leff,E,Sy)
%
% Input: t = desired wall thickness
%        dmax = maximum allowable pipe diameter
%        P = applied load
%        Leff = effective length of the tubing -- real length modified
%               by a factor to account for boundary conditions
%        E = modulus of elasticity of tubing material
%        Sy = yield stress of the tubing material

opts = optimset('Display','off');
d = fzero(@pipeLoadDeltaDia,dmax*[0.1 1],opts,t,P,Leff,E,Sy);
