Two Consider a water tank such as that pictured on the left of Figure A model ge
ID: 3822028 • Letter: T
Question
Two Consider a water tank such as that pictured on the left of Figure A model geometry from MATLAB is shown on the right Figure 1. Assume that the water tank is 20 meters and that the diameter of the tank at its widest is 40 meters. The volume of the tank is a function of the height of the water in the tank and is given by: Figure 1: Water tank and ellipsoid model of the water tank. V(h) = integral^H_0 4 pi(100 - (z - 10)^2) dz Write a MATLAB function that calculates V (H) using n = 100 as accurately as possible given a value for H between 0 and 20. Turn in your code with the Lab. Test your code on the values of H = Squareroot (20) and H = 5 pi and report your answers below. You will need this code for a future lab project as well.Explanation / Answer
function [intg] = findVol(b)
if(b>0 && b<=20)
fun = @(z) 4 * pi * (100 - (z - 10).^2);
step = (b)/100;
intg = 0
for i = 0: step: b
y = fun(i);
intg = intg + y * step;
end
end
end
outputs:
b = 4, output: 1758.6
b = 2, output: 473
b = sqrt(20), output: 2158
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.