Compute the area of a sphere of radius 10. Use loops as required to cover the area. Compute da, x, y, and z for each pass through the inner loop. Compute the area by initializing it to zero before starting the loops, and accumulate the value of da inside of the inner loop. Save the values of x, y, z. for each pass and plot as blue dots. Compute the area of the spherel using algebra, and compare to the numerical value you computed.
MATLAB SCRIPT:
clc;
close all;
clear all;
% Consider in an X-Y plane, The
cylindrical shell would look
% a concentric circles. The area within them will be pi*rout^2 -
pi*rin^2
%Now as we move up in z -axis, it gains
volume and it is given by
%Area*height
%This is how we will approach.
h = 0:1:10; %height of shell
r2 = 6; r1 = 5;
A = pi*((r2^2)-(r1^2));
dV = 0;
for i = 2:1:length(h);
dV = dV + (A*(h(i)-h(i-1)));
end
V = dV
OUTPUT:
V = 345.58
Get Answers For Free
Most questions answered within 1 hours.