球体函数可生成单位球体的x, y和z坐标, 以用于冲浪和网格。
句法
sphere // It generates a sphere consisting of 20-by-20 faces.sphere(n) // It draws a surf plot of an n-by-n sphere in the current figure.[X, Y, Z] = sphere(...) // It returns the coordinates of a sphere in three matrices that are (n+1)-by-(n+1) in size.
例子
【MATLAB 3D函数sphere()】生成并绘制一个球体。
sphere(20)axis('square')or[x, y, z]=sphere(20);
surf(x, y, z)axis('square')
输出

文章图片
推荐阅读
- MATLAB 3D函数Ribbon()
- MATLAB 3D函数ellipsoid()
- MATLAB 3D函数stem3()
- MATLAB 3D函数mesh()
- MATLAB 3D函数Waterfall()
- MATLAB 3D函数meshz()
- MATLAB函数stairs()
- MATLAB 3D函数surf()
- MATLAB 3D绘图