  close all
  x=linspace(-3*pi,3*pi,300);
  y=sin(x);
  z=(y>=0).*y;
  plot(x,z);shg

  z=z-0.5*sin(x).*(y<0);
  figure
  plot(x,z,'r');shg

 
 
