title: Meshgrid and Surf
body: <p>I just have a brief question regarding the <code>meshgrid</code> and <code>surf</code> commands in MatLab.  I have entered the following:</p>
  
  <pre><code>xx = -2:.2:2;
  yy = xx;
  [x,y] = meshgrid(xx,yy);
  z = exp(-x.^2 - y.^2);
  surf(z)
  </code></pre>
  
  <p>This produces a nice surface plot in 3D, but the x-axis and y-axis show values from 0 to 25.  Why is this?  Shouldn't the values lie between -2 and 2?  The maximum point at the surface now appears roughly at the point (12.5, 12.5, 1).  But surely this should be (0,0,1).  What is causing this?  If anyone can explain this to me, I would greatly appreciate it!</p>