Plotting a closed volume by connecting my points together

2 views (last 30 days)
*I have coordinates of some points and by connecting them in 3D, I want matlab gives me a closed volume, not just connecting the points together by lines. How can I do that?
This is my coding.*
x=[-2.03759998750000,2.03759998750000,32.7895999970000,2.03759998750000,0.875599994500000,2.03759998750000,32.7895999970000,2.03759998750000,46.8795999980000,2.03759998750000,32.7895999970000,2.03759998750000,0.875599994500000,2.03759998750000,32.7895999970000,2.03759998750000,-1.53839999775000,2.03759998750000,32.7895999970000,2.03759998750000,0.875599994500000,2.03759998750000,32.7895999970000,2.03759998750000,46.8795999980000,2.03759998750000,32.7895999970000,2.03759998750000,0.875599994500000,2.03759998750000,32.7895999970000,2.03759998750000,14.1450000037500,2.03759998750000,32.7895999970000,2.03759998750000,0.875599994500000,2.03759998750000,32.7895999970000,2.03759998750000,46.8795999980000,2.03759998750000,32.7895999970000,2.03759998750000,0.875599994500000,2.03759998750000,32.7895999970000,2.03759998750000,-1.53839999775000,2.03759998750000,32.7895999970000,2.03759998750000,0.875599994500000,2.03759998750000,32.7895999970000,2.03759998750000,46.8795999980000,2.03759998750000,32.7895999970000,2.03759998750000,0.875599994500000,2.03759998750000,32.7895999970000,2.03759998750000]';
y=[-1.47299999962500,1.47299999962500,-35.6150000071250,1.47299999962500,-73.9650000031250,1.47299999962500,-35.6150000071250,1.47299999962500,-81.3849999943750,1.47299999962500,-35.6150000071250,1.47299999962500,-73.9650000031250,1.47299999962500,-35.6150000071250,1.47299999962500,-89.1150000028750,1.47299999962500,-35.6150000071250,1.47299999962500,-73.9650000031250,1.47299999962500,-35.6150000071250,1.47299999962500,-81.3849999943750,1.47299999962500,-35.6150000071250,1.47299999962500,-73.9650000031250,1.47299999962500,-35.6150000071250,1.47299999962500,-45.8089999963750,1.47299999962500,-35.6150000071250,1.47299999962500,-73.9650000031250,1.47299999962500,-35.6150000071250,1.47299999962500,-81.3849999943750,1.47299999962500,-35.6150000071250,1.47299999962500,-73.9650000031250,1.47299999962500,-35.6150000071250,1.47299999962500,-89.1150000028750,1.47299999962500,-35.6150000071250,1.47299999962500,-73.9650000031250,1.47299999962500,-35.6150000071250,1.47299999962500,-81.3849999943750,1.47299999962500,-35.6150000071250,1.47299999962500,-73.9650000031250,1.47299999962500,-35.6150000071250,1.47299999962500]';
z=[-61.5049999987500,61.5049999987500,41.0790000005000,61.5049999987500,20.5010000002500,61.5049999987500,41.0790000005000,61.5049999987500,0.0130000062499988,61.5049999987500,41.0790000005000,61.5049999987500,20.5010000002500,61.5049999987500,41.0790000005000,61.5049999987500,-20.4589999845000,61.5049999987500,41.0790000005000,61.5049999987500,20.5010000002500,61.5049999987500,41.0790000005000,61.5049999987500,0.0130000062499988,61.5049999987500,41.0790000005000,61.5049999987500,20.5010000002500,61.5049999987500,41.0790000005000,61.5049999987500,-40.9549999897500,61.5049999987500,41.0790000005000,61.5049999987500,20.5010000002500,61.5049999987500,41.0790000005000,61.5049999987500,0.0130000062499988,61.5049999987500,41.0790000005000,61.5049999987500,20.5010000002500,61.5049999987500,41.0790000005000,61.5049999987500,-20.4589999845000,61.5049999987500,41.0790000005000,61.5049999987500,20.5010000002500,61.5049999987500,41.0790000005000,61.5049999987500,0.0130000062499988,61.5049999987500,41.0790000005000,61.5049999987500,20.5010000002500,61.5049999987500,41.0790000005000,61.5049999987500]';
F = TriScatteredInterp(x,y,z);
ti = -100:0.5:100;
[qx,qy] = meshgrid(ti,ti);
qz = F(qx,qy);
mesh(qx,qy,qz);
hold on;
plot3(x,y,z,'o');
xlabel('x')
ylabel('y')
zlabel('z')

Answers (2)

KSSV
KSSV on 18 Oct 2017
Use
surf(qx,qy,qz)

KSSV
KSSV on 18 Oct 2017
Other method is using delaunayTriangulation.
dt = delaunayTriangulation(x,y,z) ;
tetramesh(dt)

Community Treasure Hunt

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

Start Hunting!