% hump3.m
function hump3
  clear
  diary('hump3_m.out')
  format compact
  disp('hump3.m running');
  n = 9;
  m = 9;
  xg=zeros(2*n,m);
  yg=zeros(2*n,m);
  zg=zeros(2*n,m);
  r = 1.0;      % can scale
  dr = r/n;
  dang = pi/8.0; % n-1

  disp('generate points');
  for i=1:n % x
    ang = 0.0;
    for j=1:m
      xg(i,j) = r*cos(ang);
      yg(i,j) = r*sin(ang);
      zg(i,j) = 1.0-r*r;
      ang = ang + dang;
    end %j
    ang = 0.0;
    for j=1:m
      xg(i+n,j) = r*cos(ang);
      yg(i+n,j) = -r*sin(ang);
      zg(i+n,j) = 1.0-r*r;
      ang = ang + dang;
    end %j
    r = r - dr;
  end %i
  disp('xg');
  disp(xg);
  disp('yg');
  disp(yg);
  disp('zg');
  disp(zg);
  disp('hump3.m end printing')
  diary off

  % plot surface
  surf(xg,yg,zg);
  title('hump3 surf')
  xlabel('X');
  ylabel('Y');
  zlabel('Z');

  % plot
  % plot3(xg,yg,zg);
  % title('hump3 plot2')
  % xlabel('X');
  % ylabel('Y');
  % zlabel('Z');
  
end % hump3


