3 vector to surface 3d plot?

6 次查看(过去 30 天)
Le Xuan Thang
Le Xuan Thang 2022-5-23
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:

回答(1 个)

KSSV
KSSV 2022-5-23
  1 个评论
Le Xuan Thang
Le Xuan Thang 2022-5-23
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)) ;

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

标签

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by