MATLAB: Creat cylinders mesh in different positions

cylindermesh

hi how to creat three cylinders mesh in same figure the three cylinders in different positions and one of them has different degree with( intersect) other cylinder ths u

Best Answer

R = 1. ; % Radius of the cylindrical shell
H = 1. ; % Height of the Cylinder
M = 50 ;N = 100 ;
% Discretizing the Height and Angle of the cylinder
nH = linspace(0,H,M) ;
nT = linspace(0,2*pi,N) ;
[H, T] = meshgrid(nH,nT) ;
%%cylinder at (0,0)
X1 = R*cos(T);
Y1 = R*sin(T);
Z1 = H ;
%%cylinder at (1,0)
X2 = X1+1 ;
Y2 = Y1+0 ;
Z2 = Z1 ;
%%cylinder at (-1,1)
X3 = X1-1 ;
Y3 = Y1+1 ;
Z3 = Z1 ;
Related Question