title: Misaligned left and right y axes in Matlab
body: <p>I am trying to produce two sinusoidal curves onto the same graph. the two have different amplitudes, so i have a left and right y axes. however, when i have a phase difference of Pi/4, the zero points of the two y axes are not aligned, instead being skewed differently. is there any way i can prevent this? thank you.</p>
  
  <p>code:</p>
  
  <pre><code>function[] = improvised (a,b,c,d);
  % a is time period, b is amplitude red, c amplitude blue
  % d is phase shift blue relative to red
  x = (0.0:0.001*a:2*a);
  y = b*sin (2*pi*x/a);
  z = c*sin ((2*pi*x/a)+(2*pi*d/a));
  plot (x,y,'r-');
  ax = gca;
  ax.XAxisLocation = 'origin';
  yyaxis left
  xlabel ('blabla')
  ylabel('blabla')
  
  yyaxis right
  plot (x,z,'b-');
  ylabel('blabla')
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/s7mP3.png" rel="nofollow noreferrer">on the right, the x axis crosses between 0.1 and 0, for seemingly no reason</a></p>