How to make the 3d plot?

4 visualizaciones (últimos 30 días)
Hoon Jung
Hoon Jung el 21 de Mzo. de 2020
Comentada: Walter Roberson el 21 de Mzo. de 2020
vertex=[3 5 3 ; 7 5 5 ; 3 5 5 ; 3 6 5 ; 3 6 3];
face= [1 2 3 ; 2 3 4 ; 1 2 5 ; 2 4 5];
patch('Faces',face,'Vertices',vertex,'Facecolor',[0.8 0.8 1]);
view(3);
grid on
vertex=[3 5 3 ; 3 5 5 ; 3 6 5 ; 3 6 3];
face= [1 ; 2 ; 3 ; 4 ];
patch('Faces',face,'Vertices',vertex,'Facecolor',[0.8 0.8 1]);
view(3);
grid on
Hi guys i got confused about ploting 3-D pyramid.
Here ara the edge coordinates of the pyramid.
How can i plot it with all of its surfaces ?

Respuestas (1)

Walter Roberson
Walter Roberson el 21 de Mzo. de 2020
vertex=[3 5 3 ; 7 5 5 ; 3 5 5 ; 3 6 5 ; 3 6 3];
face= [1 2 3 nan; 2 3 4 nan; 1 2 5 nan; 2 4 5 nan; 1 3 4 5];
patch('Faces',face,'Vertices',vertex,'Facecolor',[0.8 0.8 1]);
view(3);
grid on
  4 comentarios
Hoon Jung
Hoon Jung el 21 de Mzo. de 2020
Editada: Walter Roberson el 21 de Mzo. de 2020
dont working .. now i use the my cell phone matlab can you show me your total code and picture ..? Sorry again ask .. and really thaks so much teach me !
Walter Roberson
Walter Roberson el 21 de Mzo. de 2020
Total code:
vertex=[3 5 3 ; 7 5 5 ; 3 5 5 ; 3 6 5 ; 3 6 3];
face= [1 2 3 nan; 2 3 4 nan; 1 2 5 nan; 2 4 5 nan; 1 3 4 5];
patch('Faces',face,'Vertices',vertex,'Facecolor',[0.8 0.8 1]);
view(3);
grid on
The output:
This is correct output. You can use the plot tools to rotate it to see other faces.
The initial part of your original attempt was:
Notice the line from the bottom left corner. That is the internal edge of the corner "behind" the view, and it is visible because your original attempt did not draw the square face at the base of the pyramid. In the code I posted, you can tell that the square face has been drawn because that line is not visible.
If you want to see with more emphasis:
vertex=[3 5 3 ; 7 5 5 ; 3 5 5 ; 3 6 5 ; 3 6 3];
face= [1 2 3 nan; 2 3 4 nan; 1 2 5 nan; 2 4 5 nan; 1 3 4 5];
patch('Faces',face,'Vertices',vertex,'FaceVertexCData', hsv(size(vertex,1)));
shading interp
view(3);
grid on

Iniciar sesión para comentar.

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