function esempio(caso)

switch caso
    case 1
        fs='sin(x)+cos(x)+1';
        f=inline(fs,'x');
        x=-1:0.01:2;
        y=feval(f,x);
        xx=linspace(-1,2,5);
        xc=xx(1:end-1)+xx(2:end); xc=xc/2;
        yc=feval(f,xc);
        
        
        clf;
        hold on;
        
        xv=[xx(1) xx(2) xx(2) xx(1) xx(1)];
        yv=[0 0 yc(1) yc(1) 0];
        fill(xv,yv,'m');
        
        xv=[xx(2) xx(3) xx(3) xx(2) xx(2)];
        yv=[0 0 yc(2) yc(2) 0];
        fill(xv,yv,'m');
        
        xv=[xx(3) xx(4) xx(4) xx(3) xx(3)];
        yv=[0 0 yc(3) yc(3) 0];
        fill(xv,yv,'m');
        
        xv=[xx(4) xx(5) xx(5) xx(4) xx(4)];
        yv=[0 0 yc(4) yc(4) 0];
        fill(xv,yv,'m');
        
        plot(x,y,'k-','LineWidth',2,...
            'MarkerEdgeColor','k',...
            'MarkerFaceColor','g',...
            'MarkerSize',10)
        plot(x,zeros(size(x)),'k-','LineWidth',1,...
            'MarkerEdgeColor','k',...
            'MarkerFaceColor','g',...
            'MarkerSize',8)
        plot(xx,zeros(size(xx)),'ko','LineWidth',1,...
            'MarkerEdgeColor','k',...
            'MarkerFaceColor','g',...
            'MarkerSize',8)
        plot(xc,zeros(size(xc)),'ko','LineWidth',1,...
            'MarkerEdgeColor','k',...
            'MarkerFaceColor','r',...
            'MarkerSize',8)
        plot(xc,yc,'ko','LineWidth',1,...
            'MarkerEdgeColor','k',...
            'MarkerFaceColor','r',...
            'MarkerSize',8);
        
        
        hold off;
        
        
    case 2 % PLOT 3x
        fs='3*x';
        f=inline(fs,'x');
        a=1; b=2000; h=0.01;
        x=a:h:b;
        y=feval(f,x);
        
        
        clf;
        hold on;
        
        % FILL REGION.
        xv=[x fliplr(x) x(1)];
        yv=[zeros(size(x)) fliplr(y) 0];
        
        fill(xv,yv,'m');
        
        plot(x,y,'k-','LineWidth',3,...
            'MarkerEdgeColor','k',...
            'MarkerFaceColor','r',...
            'MarkerSize',8);
        
        
        hold off;
        
        
        
    case 3 % PLOT 1/x
        fs='1./x';
        f=inline(fs,'x');
        a=10^(-5); b=0.01; h=0.00001;
        x=a:h:b;
        y=feval(f,x);
        
        
        clf;
        hold on;
        
        % FILL REGION.
        xv=[x fliplr(x) x(1)];
        yv=[zeros(size(x)) fliplr(y) 0];
        
        fill(xv,yv,'m');
        
        semilogy(x,y,'k-','LineWidth',3,...
            'MarkerEdgeColor','k',...
            'MarkerFaceColor','r',...
            'MarkerSize',8);
        
        
        hold off;
        
        
    case 4 % PLOT 1/(1-x)
        fs='1./(1-x)';
        f=inline(fs,'x');
        a=0; b=1-0.05; h=0.001; bb=1;
        x=a:h:b;
        y=feval(f,x);
        
        
        clf;
        hold on;
        
        % FILL REGION.
        xv=[x fliplr(x) x(1)];
        yv=[zeros(size(x)) fliplr(y) 0];
        
        fill(xv,yv,'m');
        
        % COMPLETE FILLING
        xv=[x(end) bb bb x(end) x(end)];
        yv=[0 0 y(end) y(end) 0];
        
        fill(xv,yv,'r');
        
        semilogy(x,y,'k-','LineWidth',3,...
            'MarkerEdgeColor','k',...
            'MarkerFaceColor','r',...
            'MarkerSize',8);
        
        
        hold off;
        
        
    case 5 % PLOT 1/x
        
        clear;
        
        clf;
        hold on;
        
        subplot(3,1,1);
        
        fs='(1./sqrt(x)).*sin(1./sqrt(x))';
        f=inline(fs,'x');
        a=10^(-5); b=1; h=0.001;
        x=a:h:b;
        y=feval(f,x);
        
        
        
        % FILL REGION.
        xv=[x fliplr(x) x(1)];
        yv=[zeros(size(x)) fliplr(y) 0];
        
        fill(xv,yv,'m');
        
        plot(x,y,'k-','LineWidth',3,...
            'MarkerEdgeColor','k',...
            'MarkerFaceColor','r',...
            'MarkerSize',8);
        
        subplot(3,1,2);
        
        fs='(1./sqrt(x)).*sin(1./sqrt(x))';
        f=inline(fs,'x');
        a=10^(-6); b=10^(-4); h=0.0000005;
        x=a:h:b;
        y=feval(f,x);
        
        % FILL REGION.
        xv=[x fliplr(x) x(1)];
        yv=[zeros(size(x)) fliplr(y) 0];
        
        fill(xv,yv,'m');
        
        plot(x,y,'k-','LineWidth',3,...
            'MarkerEdgeColor','k',...
            'MarkerFaceColor','r',...
            'MarkerSize',8);
        
        
        
        
        
        subplot(3,1,3);
        
        fs='(1./sqrt(x)).*sin(1./sqrt(x))';
        f=inline(fs,'x');
        a=10^(-7); b=10^(-6); h=10^(-9);
        x=a:h:b;
        y=feval(f,x);
        
        % FILL REGION.
        xv=[x fliplr(x) x(1)];
        yv=[zeros(size(x)) fliplr(y) 0];
        
        fill(xv,yv,'m');
        
        plot(x,y,'k-','LineWidth',3,...
            'MarkerEdgeColor','k',...
            'MarkerFaceColor','r',...
            'MarkerSize',8);
        
        hold off;
        
        
        
    case 6 % PLOT cos(x)
        fs='cos(x)+(1/100)*x.^2';
        f=inline(fs,'x');
        a=-2*pi; b=2*pi; h=0.001;
        x=a:h:b;
        y=feval(f,x);
        
        
        clf;
        hold on;
        
        % FILL REGION.
        xv=[x fliplr(x) x(1)];
        yv=[zeros(size(x)) fliplr(y) 0];
        
        fill(xv,yv,'m');
        
        plot(x,y,'k-','LineWidth',3,...
            'MarkerEdgeColor','k',...
            'MarkerFaceColor','r',...
            'MarkerSize',8);
        
        plot(zeros(size(y)),y,'k-','LineWidth',1,...
            'MarkerEdgeColor','k',...
            'MarkerFaceColor','r',...
            'MarkerSize',8);
        
        
        hold off;
        
        
        
    case 7 % PLOT cos(x)
        fs='sin(x)+(1/100)*x';
        f=inline(fs,'x');
        a=-(3/2)*pi; b=(3/2)*pi; h=0.001;
        x=a:h:b;
        y=feval(f,x);
        
        
        clf;
        hold on;
        
        % FILL REGION.
        xv=[x fliplr(x) x(1)];
        yv=[zeros(size(x)) fliplr(y) 0];
        
        fill(xv,yv,'m');
        
        plot(x,y,'k-','LineWidth',3,...
            'MarkerEdgeColor','k',...
            'MarkerFaceColor','r',...
            'MarkerSize',8);
        
        plot(zeros(size(y)),y,'k-','LineWidth',1,...
            'MarkerEdgeColor','k',...
            'MarkerFaceColor','r',...
            'MarkerSize',8);
        
        
        hold off;
        
        
    case 8 % PLOT cos(x)
        fs='+sqrt(1+x.^2)';
        f=inline(fs,'x');
        a=-1; b=1; h=0.001;
        x=a:h:b;
        y=feval(f,x);
        
        
        clf;
        hold on;
        
        % FILL REGION.
        xv=[x fliplr(x) x(1)];
        yv=[zeros(size(x)) fliplr(y) 0];
        
        fill(xv,yv,'m');
        
        plot(x,y,'k-','LineWidth',3,...
            'MarkerEdgeColor','k',...
            'MarkerFaceColor','r',...
            'MarkerSize',8);
        
        
        
        
        fs='-sqrt(1+x.^2)';
        f=inline(fs,'x');
        a=-1; b=1; h=0.001;
        x=a:h:b;
        y=feval(f,x);
        
        
        % FILL REGION.
        xv=[x fliplr(x) x(1)];
        yv=[zeros(size(x)) fliplr(y) 0];
        
        fill(xv,yv,'m');
        
        plot(x,y,'k-','LineWidth',3,...
            'MarkerEdgeColor','k',...
            'MarkerFaceColor','r',...
            'MarkerSize',8);
        
        
        hold off;
        
        
    case 9
        fs='sin(x)+cos(x)+1';
        f=inline(fs,'x');
        
        sudd=5;
        xx=linspace(-1,2,sudd);
        x=[];
        y=[];
        ymin=[];
        ymax=[];
        
        
        for ii=1:sudd-1
            x1=xx(ii);
            x2=xx(ii+1);
            xloc=linspace(x1,x2,100);
            yloc=feval(f,xloc);
            x=[x xloc];
            y=[y yloc];
            yminloc=min(yloc);
            ymin=[ymin yminloc];
            ymaxloc=max(yloc);
            ymax=[ymax ymaxloc];
        end
        
        clf;
        hold on;
        
        subplot(2,1,1)
        
                plot(x,y,'k-','LineWidth',2,...
             'MarkerEdgeColor','k',...
             'MarkerFaceColor','g',...
             'MarkerSize',10);
        
         hold on;
         
        for ii=1:sudd-1
            x1=xx(ii);
            x2=xx(ii+1);
            xv=[x1 x2 x2 x1 x1];
            yv=[0 0 ymin(ii) ymin(ii) 0];
            fill(xv,yv,'m'); 
            hold on;
        end
        

         
        subplot(2,1,2)
        

        
        for ii=1:sudd-1
            x1=xx(ii);
            x2=xx(ii+1);
            xv=[x1 x2 x2 x1 x1];
            yv=[0 0 ymax(ii) ymax(ii) 0];
            fill(xv,yv,'m'); 
            hold on;
        end
        
                        plot(x,y,'k-','LineWidth',2,...
             'MarkerEdgeColor','k',...
             'MarkerFaceColor','g',...
             'MarkerSize',10);  
         

        hold off;
         
         

        
%         
%         plot(x,y,'k-','LineWidth',2,...
%             'MarkerEdgeColor','k',...
%             'MarkerFaceColor','g',...
%             'MarkerSize',10)
%         plot(x,zeros(size(x)),'k-','LineWidth',1,...
%             'MarkerEdgeColor','k',...
%             'MarkerFaceColor','g',...
%             'MarkerSize',8)
%         plot(xx,zeros(size(xx)),'ko','LineWidth',1,...
%             'MarkerEdgeColor','k',...
%             'MarkerFaceColor','g',...
%             'MarkerSize',8)
%         plot(xc,zeros(size(xc)),'ko','LineWidth',1,...
%             'MarkerEdgeColor','k',...
%             'MarkerFaceColor','r',...
%             'MarkerSize',8)
%         
%         
%         yc=feval(f,xc);
%         
%         plot(xc,yc,'ko','LineWidth',1,...
%             'MarkerEdgeColor','k',...
%             'MarkerFaceColor','r',...
%             'MarkerSize',8);
        
        
        hold off;
        
        
end



