% region1.m
%
% Program to plot region of integration in xy plane
%
% region between g_1(x) and g_2(x) between x=a and x=b
%
%

     hold off;
     x=(1:.05:2);
     y1=2-(x-1.5).^2;
     y2=1+(x-1.5).^2;
     ly=length(y1);
     plot(x,y1,'w');
     hold on;
     plot(x,y2,'w');
     axis([0 2.5 0 2.5]);
     plot([.5 .5 ],[0 2.5],'w');
     plot([0 2.5 ],[.5 .5],'w');
     plot([1 1],[y1(1) y2(1)],'w--');
     plot([2 2],[y1(ly) y2(ly)],'w--');
     
%     xf=[x fliplr(x) 1];
%     yf=[y1-.05 fliplr(y2)+.05 y1(1)-.05];
%     fill(xf,yf,'red');

     xbox1=[x(11) x(11)];
     ybox1=[y1(11) y2(11)];
     plot(xbox1,ybox1,'w--');
     xbox2=[x(12) x(12)];
     ybox2=[y1(12) y2(12)];
     plot(xbox2,ybox2,'w--');

     xbox=[x(11) x(11) x(12) x(12) x(11)];
     ff=.01
     ybox=[y2(11)+ff y1(11)-ff y1(12)-ff y2(12)+ff y2(11)+ff];
     fill(xbox,ybox,'red');

     text(.95,.35,'a');
     plot([1 1],[.48 .52],'w');
     text(1.98,.35,'b');
     plot([2 2],[.48 .52],'w');

     plot([x(11) x(11)],[.48 .52],'w'); 
     text(x(11)-.05,.35,'x');
     plot([x(12) x(12)],[.48 .52],'w'); 
     text(x(12)+.02,.35,'x+dx');

     text(1.8,.95,'G_1(x)');
     text(1.8,2.0,'G_2(x)');

     text(2.3,.35,'x');
     text(.35,2.2,'y');
     
