title: Two y axis with the same x-axis
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1719048/plotting-4-curves-in-a-single-plot-with-3-y-axes">Plotting 4 curves in a single plot, with 3 y-axes</a>  </p>
  </blockquote>
  
  
  
  <p>assuming I have the following dataset as an example here in Matlab:</p>
  
  <pre><code>x = linspace(0, 9, 10);
  y1=arrayfun(@(x) x^2,x);
  y2=arrayfun(@(x) 2*x^2,x);
  y3=arrayfun(@(x) x^4,x);
  </code></pre>
  
  <p>thus you can see they have the SAME x-axis. Now I want the following plot:</p>
  
  <p>one x-axis with the limits 0 to 9 (those limits should also be ticks) with N ticks (I want to be able to define N myself), thus having N-2 ticks inbetween because 0 and 9 itself are already ticks. I want y1 and y2 to refer to the same y-axis, which is being displayed on the left with ticks for 0 and max([y1, y2]) and M more ticks inbetween.
  than I want to have another axis on the right, where y3 refers to...</p>
  
  <p>y1, y2 and y3 should have entries in the same legend box...
  thanks so far!</p>
  
  <p>edit: argh just found this: <a href="https://stackoverflow.com/questions/1719048/plotting-4-curves-in-a-single-plot-with-3-y-axes">Plotting 4 curves in a single plot, with 3 y-axes</a> perhaps I can bould it up myself... I will try just right now!</p>
  
  <p><strong>EDIT:</strong> What when using logarithmic x-axis?!</p>