title: Surf function won't graph 2D Gaussian
body: <p>I'm trying to graph a simple 2D Gaussian in MATLAB using the surf function, but I'm getting an error saying that the last value in surf must be a matrix and not a vector. I don't understand how to graph the function then as every other example I've found while searching has had the third value as a vector. I feel as if I'm completely off base here with the surf function. Any ideas?</p>
  
  <pre><code>amp = 10;
  x0 = 0;
  y0 = 0;
  sigmaX = 10
  sigmaY = 10
  X = 1:1:100;
  Y = 1:1:100;
  Z = amp*exp(-(X-x0).^2/(2*sigmaX^2)+(Y-y0).^2/(2*sigmaY^2));
  disp(size(Z))
  surf(X, Y, Z);
  </code></pre>
  
  <p><strong>Edit</strong></p>
  
  <p>When I plot this using @Suever's answer, I get something that doesn't look like a Gaussian at all.</p>
  
  <p><a href="http://i.stack.imgur.com/ECH33.png" rel="nofollow">Here's the plot</a></p>
  
  <pre><code>amp = 1;
  x0 = 0;
  y0 = 0;
  sigmaX = 1;
  sigmaY = 1;
  %X = 1:1:100;
  %Y = 1:1:100;
  [X,Y] = meshgrid(-3:.1:3);
  %Z = X .* exp(-X.^2 - Y.^2);
  Z = amp*exp(-(X-x0).^2/(2*sigmaX^2)+(Y-y0).^2/(2*sigmaY^2));
  surf(X, Y, Z);
  </code></pre>