How to make cylinder without cylinder function?

Does anyone know how to make a cylinder without using the cylinder function? Like, will meshgrid be a good way to start? I would really appreciate some advice!
Thanks a lot!

댓글 수: 1

Rik
Rik 2018년 11월 6일
It all depends on what you want as an end result. Do you want a mesh of the cylinder shell, do you want a label map for a filled cylinder, or do you want a label map for the cylinder shell only?

댓글을 달려면 로그인하십시오.

 채택된 답변

Star Strider
Star Strider 2018년 11월 6일

0 개 추천

Depending upon what you want as a result, this can be straightforward.
Example
a = linspace(0, 2*pi);
crcl = [cos(a); sin(a)];
figure
surf([crcl(1,:); crcl(1,:)], [crcl(2,:); crcl(2,:)], [2*ones(size(a)); ones(size(a))])
axis equal
This creates a cylinder with a radius of 1 and a length of 5.

댓글 수: 3

Tharaa P
Tharaa P 2020년 5월 14일
what if the hight centered at origin with unit raduis??
Hi, how can I control the radii and the height, and also the height devision?
Basically I need to create a parametric code where the user inputs the radius and length of the cylinder, number of theta division, number of z divisions and Matlab generates a meshgrid of the surface of the cylinder, based upon the points.
Thanks.
hello and if I wanted that same figure, but in the form of vectors to solve equations on that domain?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by