Need help with cylinders

7 views (last 30 days)
Mario Rodriguez
Mario Rodriguez on 11 Apr 2016
Answered: Teja Muppirala on 12 Apr 2016
Hi everyone. I want to plot and create the intersection of 2 perpendicular cylinders.
It should look like this.
Any help would be greatly appreciated!
John D'Errico
John D'Errico on 11 Apr 2016
Edited: John D'Errico on 11 Apr 2016
Walter - I think you are mistaken. That is what the intersection would look like, of two cylinders of the same radius, each aligned with one of the axes.
Visualize one cylinder along the x axis, the other along the y axis. Your point of view is above the cylinders, and off to the side.
As you can see from the cylinders, where they intersect, the surface would look as Mario wants it.

Sign in to comment.

Answers (1)

Teja Muppirala
Teja Muppirala on 12 Apr 2016
% Make a figure (I like my figures in black)
% Draw a parameterized surface
[THETA,Z] = meshgrid(linspace(-pi,pi,9),-1:0.01:1);
L = sqrt(1-Z.^2);
RHO = min( abs(L./cos(THETA)) , abs(L./sin(THETA)) ) ;
[X,Y,Z] = pol2cart(THETA,RHO,Z);
h = surf(X,Y,Z,'EdgeAlpha',0.1,'FaceColor',[0.9 0.9 0.9]);
axis equal
axis vis3d
% Add some lights
for n = 1:4

Community Treasure Hunt

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

Start Hunting!

Translated by