Surface plots and mesh
조회 수: 1 (최근 30일)
이전 댓글 표시
% 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
답변 (1개)
Walter Roberson
2013년 3월 12일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!