% plotting balls

figure();
[x,y,z] = sphere(50);

surf(x,y,z,'EdgeAlpha',0.1)  % sphere centered at origin
axis equal
title('l_2 ball');
pause();


surf(sign(x).*x.^2,sign(y).*y.^2,sign(z).*z.^2,'EdgeAlpha',0.1)  % sphere centered at (3,-2,0)
title('l_1 ball');
axis equal
pause();

pause();
for p=2:-.01:0.1
    surf(sign(x).*abs(x).^(1/p),sign(y).*abs(y).^(1/p),sign(z).*abs(z).^(1/p),'EdgeAlpha',0.1)  % sphere centered at (3,-2,0)    
    title(['l_p ball, p=',num2str(2*p)]);
    axis equal;
    pause(.08);
    if p==1,
        pause();
    end
    if p==.5,
        pause();
    end
    
    if p==.4,
        pause();
    end
    
    
end
