   clear
   close
   disp(' ')
   disp(' Level surface f(x,y,z) = x^2+y^2/4 + z^2 = 1 ')

   u = linspace(0, 2*pi, 101);
   v = linspace(0, pi, 51);
   [U,V] = meshgrid(u,v);
   X = cos(U).*sin(V);
   Y = 2*sin(U).*sin(V);
   Z =  cos(V);

   surf(X,Y,Z); shading interp; colormap(gray);
   axis equal
   hold on

   disp(' ')
   disp(' Add on the gradient vector field grad f = (2x, y/2, 2z) ')


   pause
   uu = linspace(0, 2*pi, 11);
   vv = linspace(0, pi, 11);
   [UU, VV] = meshgrid(uu,vv);
 
   XX = cos(UU).*sin(VV);
   YY = 2*sin(UU).*sin(VV);
   ZZ = cos(VV);
   quiver3(XX, YY, ZZ, 2*XX, .5*YY, 2*ZZ)
   axis image
   rotate3d on
   pause


   hold off
   close
   disp('  ')
   disp('  Another example, g(x,y,z) = x^2 +y^2 -z^2 = -1  ')
   
   clear 
   u = linspace( 0, 2*pi, 101);
   v = linspace(0, 3, 101);
   [U,V] = meshgrid(u,v);

   X = cos(U).*sinh(V);
   Y = sin(U).*sinh(V);
   Z = cosh(V);
   surf(X,Y,Z); shading interp; colormap(gray);
   axis equal
   hold on
   disp(' ')
   disp(' Add on the gradient vector field grad g = ( 2x, 2y, -2z)  ')
   pause
   uu = linspace(0, 2*pi, 11);
   vv = linspace(0,9,6);
   vv = sqrt(vv);
   [UU,VV] = meshgrid(uu,vv);
   XX = cos(UU).*sinh(VV);
   YY = sin(UU).*sinh(VV);
   ZZ = cosh(VV);
   quiver3(XX,YY,ZZ, 2*XX, 2*YY, -2*ZZ)
   axis image
   rotate3d on
   pause
   close

