3. A water tower tank can be modeled as a small diameter \"tall\" right circular
ID: 1767156 • Letter: 3
Question
3. A water tower tank can be modeled as a small diameter "tall" right circular cylinder with a big diameter "short" right circular cylinder on top. There is a bobber floating on top of the water in the tower Mounted on the bobber is a sensor that allows us to easily measure the height of the water and then calculate the total volume of water stored in the tower. Write a "User Defined Function" that can be used to calculate the volume of water in ft3 and gallons for all of the scenarios listed below. If the scenario is not possible (due to the height of the water being taller than the entire water tower or less than 0), the code should output the error code "Error - bobber height not possible". Do each of the 7 scenarios listed below (i.e. Part A, Part B, Part C,, and Part G) individually. Store the results for each of the 7 scenarios in variables having names of the following form: (e.g. (For Part A): "A gal" and "A ft3", (For Part B): "B_gal" and "B_ft3", and etcetera D Bobber height Part A 100 ft 40 ft40 ft10 ft Part B100 ft4040ft 10 ft Part C 30ft30ft 25 ft 18 ft Part D30ft30ft 25ft 18 ft Part E 80ft60ft20ft 15 ft Part F8060 f 20ft15 ft Part G80ft60 ft20ft 15 ft 55 ft 125 ft 35 ft 65 ft 65 ft 135 ft 210 ftExplanation / Answer
% User defined MATLAB function
function watervolume( A,B,C,D,Bbh )
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
if Bbh<= A && Bbh>=0
Vw=(pi*D^2*Bbh)/4
Vwg= 7.48052*Vw
elseif Bbh> A && Bbh<= A+B
Vw=((pi*D^2*A)/4)+((pi*C^2*(Bbh-A))/4)
Vwg= 7.48052*Vw
else
disp('Error- bobber height is not possible');
end
% Calling this function
clc
clear all
A=[100 100 30 30 80 80 80];
B=[40 40 30 30 60 60 60];
C=[40 40 25 25 20 20 20];
D=[10 10 18 18 15 15 15];
Bbh=[55 125 35 65 65 135 210];
for i=1:length(A)
watervolume( A(i),B(i),C(i),D(i),Bbh(i))
end
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.