Filter löschen
Filter löschen

How to make cylinder without cylinder function?

10 Ansichten (letzte 30 Tage)
Kash Costello
Kash Costello am 6 Nov. 2018
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 Kommentar
Rik
Rik am 6 Nov. 2018
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?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Star Strider
Star Strider am 6 Nov. 2018
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 Kommentare
Anton Dor
Anton Dor am 8 Jul. 2020
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.
Felipe Guerrero Medina
Felipe Guerrero Medina am 28 Dez. 2020
hello and if I wanted that same figure, but in the form of vectors to solve equations on that domain?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by