How to graph 3 cylinders together.

2 views (last 30 days)
These are the cylinders:
𝑥^2 + 𝑦^2 = 4; 𝑥^2 + 𝑧^2 = 4; 𝑦^2 + 𝑧^2 = 4

Answers (1)

KSSV
KSSV on 16 Sep 2022
Youmay modify the belo code and achieve it.
Radius = 2. ; % Radius of the cylindrical
theta = 360. ; % Angle of the Cylinder
Height = 10. ; % Height of the Cylinder
%
NH = 50 ; % Number of Elements on the Height
NT = 100 ; % Number of Angular Dicretisation
nH = linspace(0,Height,NH) ;
nT = linspace(0,theta,NT)*pi/180 ;
[H, T] = meshgrid(nH,nT) ;
% Convert grid to cylindrical coordintes
X = Radius*cos(T);
Y = Radius*sin(T);
Z = H ;
figure
hold on
surf(X,Y,Z)
surf(X,Z,Y)
surf(Y,Z,X)

Tags

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!