3 vector to surface 3d plot?

18 vues (au cours des 30 derniers jours)
Le Xuan Thang
Le Xuan Thang le 23 Mai 2022
Commenté : Le Xuan Thang le 23 Mai 2022
I have 3 vector have coordinate of 3 edge of triangle. How can I plot i in Mesh, or surface by 3D plot?
This is example: matrix f has 3 vector:
f = [0 0 288
0 28.8 259.2
0 57.6 230.4
0 86.4 201.6
0 115.2 172.8
0 144 144
0 172.8 115.2
0 201.6 86.4
0 230.4 57.6
0 259.2 28.8
0 288 0]
and figure I want to plot is:

Réponses (1)

KSSV
KSSV le 23 Mai 2022
  1 commentaire
Le Xuan Thang
Le Xuan Thang le 23 Mai 2022
thank you for your answer. If you use f matrix I post above. You can see that 3 column is 3 edge of triangle. I tried you refer link and it s have error. Can you explain to me why? This is code i use
x = f(:,1) ; y = f(:,2) ; z = f(:,3) ;
% %%structured
xi = x ; yi = unique(y) ;
[X,Y] = meshgrid(xi,yi) ;
Z = reshape(z,size(X)) ;
figure
surf(X,Y,Z)
%%unstructured
dt = delaunayTriangulation(x,y) ;
tri = dt.ConnectivityList ;
figure
trisurf(tri,x,y,z)
And this is error i have.
Error using reshape
To RESHAPE the number of elements must not change.
Error in test1 (line 19)
Z = reshape(z,size(X)) ;

Connectez-vous pour commenter.

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by