H 70 ft as shown in the figure The best view of the target
       (H = 70 ft) as shown in the figure. The best view of the target is when theta is maximum. Write a MATLAB program that determines the distance x at which when theta is maximum. Define a vector x with elements ranging from 50 to 1500 with spacing of 0.5. Use this vector to calculate the corresponding values of theta. Then use MATLAB\'s built-in function max to find the value of x that corresponds to the largest value of theta. 
  
  Solution
H = 70;
 k = 300; %assumption since not given in the problem
 thetas = zeros(2901); %create a vector of 2901 elements
 M = 0; %initialise maximum
 for x=50:0.5:1500
     a = acot(x/k); %calculation of a using geometry
     b = acot(x/(k-H)); %calculation of b using geometry
     theta = a-b;
     if theta>M
         M = theta; %updating maximum
     end
     thetas(int32((x-50)*2+1)) = theta; %adding value to the vector of thetas
 end
 disp(M); %displaying maximum value

