Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

******* USE MATLAB ********* The water tower shown is comprised of a cylindrical

ID: 2293590 • Letter: #

Question

******* USE MATLAB *********

The water tower shown is comprised of a cylindrical lower portion, and a spherical upper portion. The dimensions of each portion are shown in the diagram. Inside the tank is a float that indicates the level of water (denoted by height, h.) Ask the user to enter the water height, h, and use this information to calculate the total volume of water in the tower. 6. diamete,r asm diameter 20m You can easily look up the Volume of a cylinder, but here is how to calculate the volume of a portion of a sphere (a "spherical cap"): Where ' ba- depth of water in the sphere .r radius of the water line (corresponds to po in the picture) .[ind-ha·where R is radius of the sphere

Explanation / Answer

MATLAB code is given below.

clc;
clear all;
close all;

h = input('Enter the height of the water in the tank in meters: ');
if h > 15
hd = h-15;
elseif h>40
display('Height Can not be more than 40m');break;
else
hd = 0;
end   

R = 25/2;
r = sqrt(2*R*hd - hd^2);
V = hd*pi/6*(3*r^2+hd^2);
Vtotal = V + pi*10^2*15;

fprintf('Volume of the water in the tank in Cubic Meters: %6.2f ',Vtotal);

Result:

Enter the height of the water in the tank in meters: 20
Volume of the water in the tank in Cubic Meters: 5563.24