rotate3d on;

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

%% ----------------------------------------------------------------
[phi,theta] = meshgrid(0:.1:pi+.1, 0:.1:2*pi+.1);

x = cos(theta).*sin(phi);
y = sin(theta).*sin(phi);
z = cos(phi);
f = y.^2 - z;

%% ----------------------------------------------------------------
rotate3d on;
surf(x,y,z,f);
shading flat;

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