% reg3d.m 96/07/15
%
% Program to plot a 3D region of integration in the xyz plane
% 


% create ellipse

    theta=2*pi*(0:1:25)/25;
    x=2+cos(theta);
    y=2+0.5*sin(theta);

% Plot ellipse

    top=2;
    bot=1;
    plot3(x,y,top*ones(size(x)),'w-');
    hold on;
    axis([0 3 0 3 0 3]);
    plot3(x,y,bot*ones(size(x)),'w-');
    plot3(x,y,zeros(size(x)),'w--');

% Plot lines joining top and bottom surfaces

    plot3([x(1) x(1)],[y(1) y(1)],[top bot],'w--');
    plot3([x(7) x(7)],[y(7) y(7)],[top bot],'w--');
    plot3([x(13) x(13)],[y(13) y(13)],[top bot],'w--');
    plot3([x(19) x(19)],[y(19) y(19)],[top bot],'w--');

% Text 

    text(2.5,2.3,2.5,'z=g_2(x,y)');
    text(2.9,1.6,1,'z=g_1(x,y)');
    text(1.3,2,1.6,'R');
    text(1.5,2.2,0,'D');
    
    xlabel('x')
    ylabel('y')
    zlabel('z')

    hold off;
