MATLAB: Find the minimum value of x that corresponds to maximum value of theta

maxmin

Hello , I have :
x=30:0.5:300;
h=180;
hypot=sqrt(x.^2+h.^2);
phi=asind(h./hypot);
theta=90-phi;
Now , I want to find the minimum value of x that corresponds to maximum value of theta. How can I do this?
Thanks!

Best Answer

[~,idx]=max(theta)
out=x(idx)