How to plot a 3-D grid from a set of points with coordinates?
2 views (last 30 days)
Show older comments
Manas Ranjan Pattnayak
on 7 Apr 2018
Commented: Manas Ranjan Pattnayak
on 8 Apr 2018

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.
0 Comments
Accepted Answer
Walter Roberson
on 7 Apr 2018
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 Comments
Walter Roberson
on 8 Apr 2018
Edited: Walter Roberson
on 8 Apr 2018
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.
More Answers (0)
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!