Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2.1 (40 pts) Cylindrical storage tanks often have conical bottoms to facilitate drainage. One particular tank design specifies a radius of R, a total height
2.1 (40 pts) Cylindrical storage tanks often have conical bottoms to facilitate drainage. One particular tank design specifies a radius of R, a total height of 3R, and the height of the conical bottom to be R. Write an m-file function tank_volume.m that calculates the volume of liquid in such a tank if the liquid level is d Function: tank volume.m Inputs R: an array of R values representing the radius of the tank. The overall height of the tank 1S 3R d: an array of liquid height values measured from the bottom of the tank Outputs V: an array of tank volumes, of the same shape as the input data R and d Your function should have two checks Issue an error statement if the arrays R and d are not the same shape Issue an error if, for any value of d, d> 3R (tank overflow!). Hint: typing "doc any" at the command line will show a simple suggestion for testing all values in the array simultaneously Driver: hw2 1m Create a simple script that uses your tank_volume function to generate a plot (on a single axis) of the liquid volume vs. liquid level for R 1 m and R = 2 m. Your plot should be p (axes, title, legend). No output from the function file or the driver file should be displayed other than the plot when the driver file is executed properly labeled Hint: The volume of a cone is-; the tank radius is R
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