function y = data(m,x)

if m == 1 

    ymiddle = 1.0 - .125*x.^2.*(3.0 - x);

  y = (x < 0) + ( (x < 2.001 ) - (x< 0)  ).*ymiddle  + .5*(x > 2);

elseif m == 2
   
         ymiddle  = .25*(x+1).*(x-2).^2;

   y = (x < 0) + ( (x < 2.001 ) - (x < 0) ).*ymiddle ;

elseif m == 3

  ymiddle =  .5 - (x+1).^2 .*(x-2)/8 ;

  y =  .5*(x < -1) + ( ( x < 1.001 ) - ( x < -1) ).*ymiddle + (x > 1);

elseif m == 4

      ymiddle = .05*x.^3 - .15*x.^2 + 1.1;

    y = 1.1*(x < 0) + ( (x < 2.001) - (x < 0) ) .*ymiddle + .9*(x > 2);

elseif m ==5

  y = 1.5*exp(-2.0*(x-1).^2) + .5;

elseif m ==6

     y = 2.0*(x-1).*exp(-4.0*(x-1).^2) + .5;


end


