MATLAB Answers

Plot a cyinder with height from one value to another

11 views (last 30 days)
F.O
F.O on 4 Nov 2017
Commented: Star Strider on 5 Nov 2017
I want to plot a cylinder with height that goes from -4 to 4 and radius 2?

  3 Comments

John D'Errico
John D'Errico on 4 Nov 2017
What have you tried? If nothing, why not? Did you read the help for cylinder? WHY NOT?
F.O
F.O on 5 Nov 2017
Yes, I have read that but it didn't tell you how to change the height or make it go from negative values to positive values which we always have in mathematics problems.

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 5 Nov 2017
I can’t determine if this is a homework assignment or not.
The plot is straightforward:
r = 2;
t = linspace(0, 2*pi);
cyl = [r*cos(t); r*sin(t)];
figure(1)
plot(cyl(1,:), cyl(2,:))
figure(1)
surf([cyl(1,:); cyl(1,:)], [cyl(2,:); cyl(2,:)], [-4*ones(1,size(cyl,2)); 4*ones(1,size(cyl,2))])
grid on
axis equal

  2 Comments

F.O
F.O on 5 Nov 2017
Not assignment but i wanted to plot a cylinder with a plane thate intersect with it to calculate the line integral over the curve of intersection
Star Strider
Star Strider on 5 Nov 2017
My code will plot the cylinder, as you requested.
I leave the rest to you.

Sign in to comment.

More Answers (0)

Sign in to answer this question.

Tags

Products