I just have a brief question regarding the meshgrid and surf commands in MatLab. I have entered the following:
xx = -2:.2:2;
yy = xx;
[x,y] = meshgrid(xx,yy);
z = exp(-x.^2 - y.^2);
surf(z)
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!
You would need to tell
surfwhat the axis scaling is usingSee the
surfdocumentation.