A water tower tank has the same shape of a cylinder with a frustum on top
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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
Antworten (1)
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
0 Kommentare
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!