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

Write a MATLAB program in a script file that determines the radius, r, of the la

ID: 1996694 • Letter: W

Question

Write a MATLAB program in a script file that determines the radius, r, of the largest sphere that can be inscribed inside a cone with base radius R and height h as, r = h/Squareroot1 + (h/R)^2 + 1 For input the program asks the user to enter values for R and h. The program then calculates r rounded to the nearest tenth. For output the program displays the message: "The radius of the largest sphere that can be inscribed inside a cone with a base radius of XX in. and heights of XX in. is: XX in." where XX are the corresponding numerical values. Use the program to determine r for a cone with R = 8 in. and h = 22 in. Use fprintf () to display the output in f format with a field width of 5 and one decimal digit You can display your output in 2 or more lines using multiple fprintf ().

Explanation / Answer

Code:

R=input('enter the value of R=');
h=input('enter the value of h=');
r1=h/(1+sqrt(1+((h/R)^2)));
round(r1);
fprintf('The radius of largest sphere that can be inscribed inside a cone with base radius %5.1f in. and height %5.1f in. is: %5.1f in. ',R,h,r1);

Result:

enter the value of R=8
enter the value of h=22
The radius of largest sphere that can be inscribed inside a cone
with base radius 8.0 in and height 22.0 in is: 5.6 in>> LabProb3_2
enter the value of R=8
enter the value of h=22
The radius of largest sphere that can be inscribed inside a cone
with base radius 8.0 in. and height 22.0 in. is: 5.6 in.

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