Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help me with it, Urgent! R 2.4 (9 pts) A cylindrical storage tank has a conical bottom to facilitate drainage. One particular tank design
Please help me with it, Urgent!
R 2.4 (9 pts) A cylindrical storage tank has a conical bottom to facilitate drainage. One particular tank design specifies a radius of R, a total height of 4R, 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 h. Function: tank_volume.m 3R Inputs: R: an array of R values representing the radius of the tank. h h: an array of liquid height values measured from the bottom of the tank R 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 h are not the same shape Issue an error if, for any value of h, h > 4R (tank overflow!). Hint: typing "doc any at the command line will show a simple suggestion for testing all values in an array simultaneously. There are other ways to test this, as well, such as using loops. Driver Script: HW2_4.m Create a simple script that uses your tank_volume function to generate a plot (on a single set of axes) of the liquid volume vs. liquid level for R = 1 m and R = 2 m. Your plot should be properly labeled (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. Hint: The volume of a cone with ar21 radius r and length 1 is worked / 3Step 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