3 vector to surface 3d plot?

조회 수: 6 (최근 30일)
Le Xuan Thang
Le Xuan Thang 2022년 5월 23일
댓글: 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