3 vector to surface 3d plot?

5 views (last 30 days)
Le Xuan Thang
Le Xuan Thang on 23 May 2022
Commented: Le Xuan Thang on 23 May 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:

Answers (1)

KSSV
KSSV on 23 May 2022
  1 Comment
Le Xuan Thang
Le Xuan Thang on 23 May 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)) ;

Sign in to comment.

Tags

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!