Plot a cyinder with height from one value to another

I want to plot a cylinder with height that goes from -4 to 4 and radius 2?

3 件のコメント

John D'Errico
John D'Errico 2017 年 11 月 4 日
What have you tried? If nothing, why not? Did you read the help for cylinder? WHY NOT?
Stephen23
Stephen23 2017 年 11 月 4 日
F.O
F.O 2017 年 11 月 5 日
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.

サインインしてコメントする。

 採用された回答

Star Strider
Star Strider 2017 年 11 月 5 日

0 投票

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 件のコメント

F.O
F.O 2017 年 11 月 5 日
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 2017 年 11 月 5 日
My code will plot the cylinder, as you requested.
I leave the rest to you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGraphics Performance についてさらに検索

製品

タグ

質問済み:

F.O
2017 年 11 月 4 日

コメント済み:

2017 年 11 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by