Surface plots and mesh
1 view (last 30 days)
Show older comments
% So here is the problem, Say I have the following arrays:
x = [1, 2, 3];
y = [1, 2, 3];
A = [1, 1, 1; 1, 2, 1; 1, 1, 1];
Using surface plots:
surf(x,y,A)
I would expect (and want) the plot to be a 3x3 grid with A(2,2) at a higher elevation. What I get is a grid of 2x2!
Following this with a 5x5 grid of pyramid numbers I get a 4x4 grid output from surf. I guess I would like the point plotted to be in the centre of a "square"?
Anyway to change this behaviour?
0 Comments
Answers (1)
Walter Roberson
on 12 Mar 2013
There is no way to change that behavior. surf() always creates points from the interior vertices, and since there are N-1 interior vertices for a side of length N, there will always be one fewer row and columns.
The closest you can get is to use image() (if you do not need something 3D) or to do a texture mapping onto a patch (or surface) if you need something 3D.
0 Comments
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!