clear variables
set(0, 'DefaultAxesFontName', 'Times New Roman', 'DefaultAxesFontSize', 14);

Nh = 576;
h1 = linspace(0,2,Nh);
h2 = linspace(2,4,Nh);

for k = 1:Nh
    
    h(k) = h1(k);
    V(k) = pi*(h(k)^3)/6;
    
end

for k = 1:Nh
    
    h(k+Nh) = h2(k);
    V(k+Nh) = pi*(h(k+Nh)^3 + 12*h(k+Nh))/24;
    
end

figure(1)
plot(h,V,'k.','MarkerSize',1)
xlabel('Height, h (in units of R)')
ylabel('Volume, V')
title('Graph A, Plot of Volume Against Height')