How do I draw a solid cylinder ?/
조회 수: 9 (최근 30일)
이전 댓글 표시
Can anyone please let me know how can I create a solid cylinder in matlab? I was able to create a hollow cylinder using different methods but unable to plot a solid cylinder. Any help would be greatly appreciated.
댓글 수: 0
채택된 답변
Walter Roberson
2012년 1월 25일
MATLAB does not have any graphics primitives for solid objects. You can color the faces of a hollow object, but not much more.
댓글 수: 0
추가 답변 (1개)
Dr. Seis
2012년 1월 25일
There probably exists a better way to do this, but:
D = 5; % Diameter
H = 10; % Height
A = 360; % Angles to plot
theta = (0 : 1 : (A-1))*360/A;
X = [(D/2*cosd(theta))' (D/2*sind(theta))' ones(A,1)*H/2];
X = [X ; X*[1,0,0;0,1,0;0,0,-1]];
options = {'Qt','Qbb','Qc'};
Tes = delaunay3(X(:,1),X(:,2),X(:,3),options);
tetramesh(Tes,X);
colormap(white);
face_alpha = 1.0;
alpha(face_alpha)
shading flat
axis equal
light('Position',[-0.58674 -0.05336 0.80801],'Style','infinite')
light('Position',[-0.58674 -0.05336 -0.80801],'Style','infinite')
댓글 수: 1
Walter Roberson
2012년 1월 25일
However, an object internally divided in to a number of smaller objects, each of which is hollow, is not really a solid object.
참고 항목
카테고리
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!