How to plot a 3-D grid from a set of points with coordinates?

4 ビュー (過去 30 日間)
Manas Ranjan Pattnayak
Manas Ranjan Pattnayak 2018 年 4 月 7 日
I have the following set of control points to draw the Bezier surface. I have finished plotting the surface using mesh and surf commands. However, I can not find any solution to plot those 'green grids'.
points_x1 = [0;0;0;0;1;1;1;1;2;2;2;2;3;3;3;3]; % X - coordinate of control points for the surface
points_y1 = [0;1;2;3;0;1;2;3;0;1;2;3;0;1;2;3]; % Y - coordinate of control points for the surface
points_z1 = [0;1;1;0;1;2;2;1;1;2;2;1;0;1;1;0]; % Z - coordinate of control points for the surface
Kindly help.

採用された回答

Walter Roberson
Walter Roberson 2018 年 4 月 7 日
mesh() and surf() both permit you to pass an EdgeColor parameter as an rgb triple. The same edge color would be used for all edges.
mesh() and surf() both permit you to pass 'Marker', 'o', 'MarkerFaceColor, 'r' along with 'MarkerSize'
mesh() and surf() both construct surface() objects. The difference between mesh() and surf() is that mesh() automatically turns off FaceColor and surf() leaves it on. As you are interested in showing the faces, you would call surf()
  5 件のコメント
Walter Roberson
Walter Roberson 2018 年 4 月 8 日
編集済み: Walter Roberson 2018 年 4 月 8 日
x = reshape(points_x1, 4, []);
y = reshape(points_y1, 4, []);
z = reshape(points_z1, 4, []);
hold on
h = mesh(x, y, z, 'EdgeColor', 'g', 'Marker', 'o', 'MarkerEdgeColor', 'r', 'MarkerSize', 10);
hold off
The 4 is because your points form a 4 x 4 grid of locations. To create the rectangular mesh automatically the points have to be arranged in row/column format.
Manas Ranjan Pattnayak
Manas Ranjan Pattnayak 2018 年 4 月 8 日
Thank you so much. I got the required plot.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by