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

2 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Walter Roberson
Walter Roberson il 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 Commenti
Walter Roberson
Walter Roberson il 8 Apr 2018
Modificato: Walter Roberson il 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.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by