Plotting a closed volume by connecting my points together

조회 수: 4 (최근 30일)
MA
MA 2017년 10월 18일
답변: KSSV 2017년 10월 18일
*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')

답변 (2개)

KSSV
KSSV 2017년 10월 18일
Use
surf(qx,qy,qz)

KSSV
KSSV 2017년 10월 18일
Other method is using delaunayTriangulation.
dt = delaunayTriangulation(x,y,z) ;
tetramesh(dt)

카테고리

Help CenterFile Exchange에서 3-D Volumetric Image Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by