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

An airplane is flying at a height of h = 900 ft while watching a target that is

ID: 3573715 • Letter: A

Question

An airplane is flying at a height of h = 900 ft while watching a target that is 70 ft tall (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 theta is maximum. Define a vector x with element 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 fraction max to find the value of x that corresponds to the largest value of theta.

Explanation / Answer

The MATLAB built-in function max returns the indices of the maximum values in a vector.

Use the following MATLAB code with the built-in function max to find the value of x at which is maximum:

clear, clc

H=70; % height of the target

h=900; % the flying height of the airplane

x=50:0.5:1500; % vary the vector x

theta=atan(h./x)-atan((h-H)./x); % calculate the value of theta

[max_theta index]=max(theta); % find max value of theta

disp('The best view of the target occurs at a distance of’)

disp(x(index))

Place the MATLAB code in the command window to get the output.

The best view of the target occurs at a distance of

864.5000

Hence, the best view of the target is possible at a distance of 864.5 feet.

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