n = linspace(1.2,1.8);

thetai = pi/180*6;

y = sqrt(n.^2-sin(thetai)^2)+sin(thetai)*sqrt(n.^2-1)-n.^2/sqrt(2);

plot(n,y);

grid on;

for i=1:100

    if(y(i)<0)

        break;

    end

end

y(i)

1/2*(n(i)+n(i-1))