Vercat Issue with 3D plot
조회 수: 7 (최근 30일)
이전 댓글 표시
I am generating a code for two cylinders, and even though I manage to plot them on 3d as desired by the use of hold on's, when attempting to generate a large matrix summarising both cylinders, I get a surface connecting the two shapes that I have not defined anywhere. My code is:
[x,y,z] = cylinder(50,500);
mesh(x,y,z)
hold on
[x1,y1,z1] = cylinder(45,500);
z1 = z1* 10;
mesh(x1,y1,z1);
hold on
[x2,y2,z2] = cylinder([45 50],500);
z2(1,:) = 10;
z2(2,:) = 10;
mesh(x2,y2,z2);
hold on
[x3,y3,z3] = cylinder([45 50],500);
z3(1,:) = 0;
z3(2,:) = 0;
mesh(x3,y3,z3);
hold on
[x4,y4,z4] = cylinder(20,500);
z4 = z4*10;
mesh(x4,y4,z4);
hold on
[x5,y5,z5] = cylinder(25,500);
z5 = z5*10;
mesh(x5,y5,z5);
hold on
[x6,y6,z6] = cylinder([20 25],500);
z6(1,:) = 0;
z6(2,:) = 0;
mesh(x6,y6,z6);
hold on
[x7,y7,z7] = cylinder([20 25],500);
z7(1,:) = 10;
z7(2,:) = 10;
mesh(x7,y7,z7);
hold on
x = vertcat(x1,x2,x3,x4,x5,x6,x7);
y = vertcat(y1,y2,y3,y4,y5,y6,y7);
z = vertcat(z1,z2,z3,z4,z5,z6,z7);
mesh(x,y,z)
I want to get rid of the surface which matches the two cylinders. You will be able to see the shape I want if you delete the last three lines of the code.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!