hemicylinder
Version 1.0.0 (1.66 KB) by
Nick Van Oosterwyck
Generates cylinder with hemispherical ends.
Syntax
[X,Y,Z] = hemicylinder
[X,Y,Z] = hemicylinder(r)
[X,Y,Z] = hemicylinder(r,h)
[X,Y,Z] = hemicylinder(r,h,n)
hemicylinder(___)
hemicylinder(ax,___)
Description
[X,Y,Z] = hemicylinder returns the x-, y-, and z- coordinates of a cylinder with hemispherical ends without drawing it. The returned cylinder with hemispherical ends has a radius equal to 1, a cylinder height equal to 1, 20 equally spaced points around its circumference and two hemisphere that consist each of 20-by-20 faces.
The function returns the x-, y-, and z- coordinates as three 42-by-21 matrices.
To draw the cylinder with hemispherical ends using the returned coordinates, use the surf or mesh functions.
[X,Y,Z] = hemicylinder(r) returns the x-, y-, and z- coordinates of a cylinder with hemispherical ends with a radius equal to r and a cylinder height equal to 1. The function returns the x-, y-, and z- coordinates as three 42-by-21 matrices.
[X,Y,Z] = hemicylinder(r,h) returns the x-, y-, and z- coordinates of a cylinder with hemispherical ends with a radius equal to r and a cylinder height equal to h. The function returns the x-, y-, and z- coordinates as three 42-by-21 matrices.
[X,Y,Z] = hemicylinder(r,h,n) returns the x-, y-, and z- coordinates of a cylinder with hemispherical ends with a radius equal to r and a cylinder height equal to h. The function returns the x-, y-, and z- coordinates as three (2n+2)-by-(2n+2) matrices.
hemicylinder(___) plots the cylinder with hemispherical ends without returning the coordinates. Use this syntax with any of the input arguments in previous syntaxes.
hemicylinder(ax,___) plots into the axes specified by ax instead of the current axes. Specify the axes as the first input argument.
See Also
Cite As
Nick Van Oosterwyck (2024). hemicylinder (https://www.mathworks.com/matlabcentral/fileexchange/125105-hemicylinder), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2022b
Compatible with R2006a and later releases
Platform Compatibility
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0 |