Skip to content

cylinder

Generate coordinate matrices for a unit cylinder.

[X, Y, Z] = cylinder
[X, Y, Z] = cylinder(r)
[X, Y, Z] = cylinder(r, n)

Returns coordinate matrices for a cylinder. Optional r (a scalar or radius profile vector) controls radius along the height — a constant for a regular cylinder, varying for a vase / horn / cone shape. Default n = 20 faces.

[X, Y, Z] = cylinder(1);
[X, Y, Z] = cylinder([1 0.5 1]); % hourglass profile
  • sphere — Generate coordinate matrices for a unit sphere.
  • surf — 3D surface plot with colored faces.