A water tower tank has the same shape of a cylinder with a frustum on top

12 Ansichten (letzte 30 Tage)
JoB
JoB am 7 Apr. 2016
Beantwortet: malek q am 24 Nov. 2021
A water tower tank has the same shape of a cylinder with a frustum on top. Write a function tankvol() that receives five inputs: the lower diameter of the tank, the upper diameter of the tank, the height of the cylinder, the height of the frustum, and the water level. Your function should output the volume in meters cubed. Write code that uses the function and ensure that it shows it works when the water level is negative, too large, within the cylinder, and within the frustum.
  3 Kommentare
JoB
JoB am 8 Apr. 2016
Bearbeitet: Walter Roberson am 8 Apr. 2016
Since the question doesn't specify the specifics measurement of the water tower tank, I am not sure how to start it. I've did a question similar before this and this question is base on it
function v = watervol(h)
% watervol calculates the volume of the water in the water tower.
% The input is the water level in meters.
% The output is the water volume in cubic meters.
if h<= 19
v = pi*12.5A
2*h;
else
rh=12.5 + 10.5*(h-19)/14;
v = pi*12.5^2*19 + pi*(h- 19)*(12.5^2 + 12.5*rh + rh^2)/3;
-
end

Melden Sie sich an, um zu kommentieren.

Antworten (1)

malek q
malek q am 24 Nov. 2021
h = input('What is the height of the tank? '); r = 12.5; if h <= 19 && h >0 h1 = h; h2 = 0; end if h > 19 && h < 33 h1 = 19; h2 = h-19; end rh = h2*(23-12.5)/14+12.5;
Volume = pi/3 * (rh^2+ rh*r + r^2)*h1 + pi*r^2*h2; Volume

Kategorien

Mehr zu Automotive finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by