function [lampoltop, lampolbot, lamtiptop, lamtipbot] = Bracket_sol2(lampip,Atarg,lampole, lambase,A0proj,lamtip) % This function finds the bordering values where the two curves, specified % by lamm_pip,(area-A0disk) and lammbase,A0proj intersect % First put A0s(lamm) and A0p(lamm) on a common scale for lamda. We keep % the disk values fixed and adjust the pipette values by interpolation and % extrapolationin the funcion align_lam. [Atarg_al,lampole_al,Aproj_al,lamtip_al,lamcom] = align_lam2(lampip,Atarg,lampole, lambase,A0proj,lamtip); % Now find the index for the crossing point by looking for the point where the % sign of the differnce between the areas changes. npts = length(lamcom); icross = 1; for i = 2:npts if sign(Atarg_al(i) - Aproj_al(i)) ~= sign(Atarg_al(i-1)-Aproj_al(i-1)) icross = i-1; % This is the index value just below the crossing point break end end % Now that we know where the two curves cross, return the upper and lower % bounds on the interval % Fudge spreads the interval a little in case the intersection is too near a boundary lampoltop = lampole_al(icross+1); lampolbot = lampole_al(icross); lamtiptop = lamtip_al(icross+1); lamtipbot = lamtip_al(icross);