Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

15) Have the user input the altitude of the airplane, h. Then write to the Comma

ID: 3668156 • Letter: 1

Question

15) Have the user input the altitude of the airplane, h. Then write to the Command Window the same text in the answer section, which used h = 900 ft as in the example. Note: underline values should be the values of appropriate variables entered or calculated.

15. An airplane is flying at a height of 900 ft while watching a target that is 70 ft tal (H- 70 ft), as shown in the igure. Tbe best view of the target is when 0 is maximum. Write a MATLAB program that detemies the distance x at which 0 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 0. Then use MATLAB's built-in func- tion max to find the value of x that corresponds to the largest value ofe.

Explanation / Answer

in the above figure

angle X = tan-1(x/h)

angle Y = tan-1( x / (h-70) )

hence Theta = Y - X = tan-1 (x/h) - tan-1 (x/ (h-70) )

matlab program:

h=input('enter the height:');%reading height
x=50:0.5:1500;%creating x vector from 50 to 1500 in steps of 0.5
theta = atand(x/(h-70)) - atand(x/h);% finding theta for each value of x
max_theta = max(theta)% finding maximum value of theta
x_for_max_theta = x(find(theta == max_theta)); % finding x value corresponding to max value of theta
fprintf("value of x that give maximum value of theta = %f is %f ",max_theta,x_for_max_theta);

Output:

enter the height:900   

max_theta =  2.3190

value of x that give maximum value of theta = 2.318959 is 864.500000

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote