clear all
close all
clc
%--------------------------------------------------------------------------
%***************************** CYLINDER ***********************************
%--------------------------------------------------------------------------
A = 0; % alpha mod: 1 - on / 0 - off.
r = linspace(1,3,20); % radius of cylinder;
u = linspace(-pi,pi,50); % u parameter;
v = 0:7; % v parameter;
%------------------------------------------
%**** lateral surface of the cylinder ****|
%------------------------------------------
for i = 1:length(r)
[U,V] = meshgrid(u,v);
x = r(i).*cos(U);
y = r(i).*sin(U);
z = V;
if A == 1
s = surf(x,y,z)
hold on
alpha(s,0.3)
else
s = surf(x,y,z)
hold on
end
end
%------------------------------------------
%******* top and bottom end-cup **********|
%------------------------------------------
theta = linspace(min(u),max(u),length(u));
r = linspace(min(r),max(3),length(r));
[THETA,R]=meshgrid(theta,r);
for i = 0:max(v)
z = zeros(size(R))+i;
[X,Y,Z]=pol2cart(THETA,R,z);
if A == 1
s = surf(X,Y,Z)
alpha(s,0.3)
else
s = surf(X,Y,Z)
end
end
zlim([min(v)-2 max(v)+2])
colormap('winter')
xlabel('X')
ylabel('Y')
zlabel('Z')
인용 양식
Artem Sulim (2024). Cylinder (https://www.mathworks.com/matlabcentral/fileexchange/94660-cylinder), MATLAB Central File Exchange. 검색됨 .
MATLAB 릴리스 호환 정보
개발 환경:
R2021a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux태그
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!버전 | 게시됨 | 릴리스 정보 | |
---|---|---|---|
1.0.0 |