title: How to slide a plotted line in matlab figure
body: <p>I am plotting a sin and cosine using below code: </p>
  
  <pre><code>x = 0 : 0.1 : 2*pi ;
  y1 = sin (x) ;
  y2 = cos (x) ;
  figure ;
  plot(x,y1) ;
  hold ;
  plot(x,y2,'r')
  </code></pre>
  
  <p>I want to move/slide the line corresponding to sin in order to overlay on top of line corresponding to cos and want to achieve it without moving pan. I searched ob web but unable to find a simple solution. </p>