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

2 visualizaciones (últimos 30 días)
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.

Respuesta aceptada

Walter Roberson
Walter Roberson el 7 de Abr. de 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 comentarios
Walter Roberson
Walter Roberson el 8 de Abr. de 2018
Editada: Walter Roberson el 8 de Abr. de 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.
Manas Ranjan Pattnayak
Manas Ranjan Pattnayak el 8 de Abr. de 2018
Thank you so much. I got the required plot.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by