% plot4.m 96/07/14
%
% Program to plot simple graph of integral of surface
% 

    [X,Y]=meshgrid(1:.1:3);
    Z=4-.5*(X-2).^2-.5*(Y-2).^2;

    hold off;

% Plot surface

    colormap('white');
    mesh(X,Y,Z);
    axis([0 4 0 4 0 4]);
    hold on

% Plot rectangle in z plane

    plot3([1 1],[1 3],[0 0],'w--'); 
    plot3([3 3],[1 3],[0 0],'w--'); 
    plot3([1 3],[1 1],[0 0],'w--'); 
    plot3([1 3],[3 3],[0 0],'w--'); 

% Plot lines connecting rectangle with surface

%    plot3([1 1],[1 1],[0 3],'w--');
%    plot3([1 1],[3 3],[0 3],'w--');
%    plot3([3 3],[1 1],[0 3],'w--');
%    plot3([3 3],[3 3],[0 3],'w--');

% Plot grid in xy plane
   
    plot3([1 3],[1.66 1.66],[0 0],'w--');
    plot3([1 3],[2.33 2.33],[0 0],'w--');
    plot3([1.66 1.66],[1 3],[0 0],'w--');
    plot3([2.33 2.33],[1 3],[0 0],'w--');

% Plot lines to surface from center rect

    plot3([1.66 1.66],[1.66 1.66],[0 3.94],'w--');
    plot3([1.66 1.66],[2.33 2.33],[0 3.94],'w--');
    plot3([2.33 2.33],[1.66 1.66],[0 3.94],'w--');
    plot3([2.33 2.33],[2.33 2.33],[0 3.94],'w--');


% Text

    text(1.1,.5,0,'a');
    text(3.0,.5,0,'b');
    text(.4,1.2,0,'c');
    text(.4,3.2,0,'d');
%    text(1.8,2.1,0,'R(I,J)')
    text(3.5,2,3.5,'z=f(x,y)');



    xlabel('x');
    ylabel('y');
    zlabel('z');
    hold off;
