Surface plots and mesh
3 ビュー (過去 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!