The radius r of a sphere can be calculated from its volume V
Solution
v=[4000,3500,3000,2500,2000,1500,1000];
b=zeros(7,3); %array for storing r,v,s values
for i=1:7
t=(3*v(i))/(4*pi);
r=nthroot(t,3); %cube root function
b(i,1)=r;
b(i,2)=v(i);
b(i,3)=2*pi*r*r;
end
clc;
disp(b); %printing actual values
disp(floor(b)); %nearest values using floor values
disp(ceil(b)); %nearest values using ceil values
output:-
1.0e+003 *
0.0098 4.0000 0.6093
0.0094 3.5000 0.5574
0.0089 3.0000 0.5030
0.0084 2.5000 0.4454
0.0078 2.0000 0.3838
0.0071 1.5000 0.3168
0.0062 1.0000 0.2418
9 4000 609
9 3500 557
8 3000 502
8 2500 445
7 2000 383
7 1500 316
6 1000 241
10 4000 610
10 3500 558
9 3000 503
9 2500 446
8 2000 384
8 1500 317
7 1000 242
>>
