### a cylindrical silo with radius r has a spherical cap roof with radius R. the height of the cylindrical portion is H. write a program in a script file that determines the height H for given values of r, R and the volume V. In addition, the program also calculates the surface area of the silo. Use the program to calculate the height and surface area of a silo with r=30 m , R=45m and volume of 120000 cubic metre.. assign values for r,R and V in the command window.

Problem: A cylindrical silo with radius r has a spherical cap roof with radius R. the height of the cylindrical portion is H. write a program in a script file that determines the height H for given values of r, R and the volume V. In addition, the program also calculates the surface area of the silo. Use the program to calculate the height and surface area of a silo with r=30 m , R=45m  and volume of 120000 cubic metre.. assign values for r,R and V in the command window.

USING MATLAB 7.0 SOFTWARE

% in script file

theta=asin(r/R);
h=r*(1-cos(theta));
Vcap=pi*h^2*(3*R-h)/3;
H=(V-Vcap)/(pi*r^2);
s=2*pi*(r*H+R*h);
fprintf('the height H is %f mt',H)
fprintf('\n the surface area of silo is %f',s)

% command window
>> r=30;
>> R=45;
>> V=120000;
>> silo
the height H is 39.688478 mt
the surface area of silo is 9641.068715>>