Question: Using MATLAB, answer the following question: A fuel tank is made of a half cylinder of radius r and length L as shown in Figure.
Using MATLAB, answer the following question:

A fuel tank is made of a half cylinder of radius r and length L as shown in Figure. The amount of fuel in gallons as a function of h is given by the following equation. L 2 cos fuel 231 In your script file, prompt the user to enter in a tank radius, r, and length, L, in inches using the input function. Then calculate the volume of fuel using the equation for a total of 21 heights ranging from 0 to r. Round your final calculation to the nearest tenth of a gallon Print out the results using the fprintf function with the appropriate format to display the results to the command window as shown below (NOTE: you do not need to display the comments). (HINT: use the example seen in week4Soln.m" on UB!earns > Course documents> Lecture notes> In-class activites.) Create a new array that contains the height values in column 1 and the calculated volume values in column 2, Save this new array to an ascii file format with the name Hw4P3.dat" that can be read by other platforms/programs. To test your program, you may test your script with the following values I. r = 10 in and L = 20 in 2. r = 20 in and L = 30 in 3. r 30 in and L-40 in to Command Window Please enter in the radius of the tank in inches: 10 Please enter in the length of the tank in inches 20 % This line must be empty For a half-cylindrical fuel tank of radius = 10.00 in and length = 20.00 in, the volume of fuel in the tank as a function of height is: % This line must be empty Height Volume [inches] [Gallons] 0.00 0.50 1.00 0.00 0.20 0.50
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
