Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem # 3 A cylindrical, vertical water tank has hemispheric end caps as shown. The radius of the cylinder and the caps is r =
Problem #
A cylindrical, vertical water tank has hemispheric end caps as shown. The radius of the cylinder and the caps is and the length of the cylindrical part is
Hint:
For a hemispherical "concave up bowl of radius the volume of water contained in it at a water level height is:
You are interested in developing a program to find the volume of water contained in the tank at a given height
Required Tasks
Write a MATLAB function named calculatevolume that fulfills these specs:
Accepts the radius in cylinder height in and the height in as input arguments.
Calculates the volume of water inside the tank if the water level is
Hint: Think of the tank as three distinct regions, each with its own set of volume equations.
While you could put all of the selection and calculation code within calculatevolume, consider writing additional functions to make your program more modular or efficient.
Returns the computed volume as the output argument.
Create a MATLAB script that tests your function. The specifications are:
Within a loop:
Displays a menu of which allow the user to select from these options: enter a single value, or plot a graph of volume versus height or quit the program.
If requested, calls your calculatevolume function to do the actual calculation and then displays the result.
If the user wants a plot, then it should be generated like this:
Plots water volume versus height where goes from to the full height of the tank.
Has reasonable axes labels and a title.
Do NOT use elementbyelement operators for this problem. Instead, use a for loop to create the vectors needed to make the plot.
Save your script file using this file name: hwxm
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started