You are designing a spherical tank, as shown in figure below, to hold water for a sonll village in
a developing country. The volume of liquid it can hold can be compuned as
V=pi*h2*
(3R-h)/3
where V is the volume of water in the tank in m3, b is the height of water in the tank in m, R is
the radius of tank in m. If R is 3m and V is 30 m.
Formulate the equation in terms of height (h), from above generalized equation, representing the
present situation
Use the correct built-in function in MATLAB to determine all possible values of height (h) that
will satisfy the formulated equation i.e. determine all possible roots of the formulated equation.
From those values height (h) which one is the correct and why?
"V(h) = \\pi h^2\\frac{3R-h}{3} = -\\frac{\\pi}{3}h^3 +\\pi R h^2"
So the task is to find roots of the polynomial "\\frac{\\pi}{3} h^3 -\\pi R h^2 +V"
>> R = 3; % The radius of tank (m)
V = 30; % Water volume in the tank (m^3)
p = [pi/3, -pi*R, 0, 0, V]; % Polynomial
r = roots(p) % Roots of the polynomial
polyval(p, r(2)) % Check
r =
8.9602 + 0.0000i
1.5679 + 0.0000i
-0.7641 + 1.2064i
-0.7641 - 1.2064i
ans =
1.3500e-13
>>
The correct value for the height is the second: 1.5679
The last two are complex roots, and the first one is greater than the radius R
Comments
Leave a comment