hold on;
rotate3d on;

% Critical points of f(x,y,z) = y^2 - z on S^2.

%% ----------------------------------------------------------------
[phi,theta] = meshgrid(0:.1:pi, 0:.1:2*pi);
x = cos(theta).*sin(phi);
y = sin(theta).*sin(phi);
z = cos(phi);

f = y.^2 - z;

%% ----------------------------------------------------------------
surf(x,y,z,f);

set(gcf, 'PaperPositionMode', 'Manual');
set(gcf, 'PaperPosition', [0 0 5.0 4.0])
print -depsc y2z


