📅  最后修改于: 2021-01-07 03:01:25             🧑  作者: Mango
球体函数生成单位球体的x坐标,y坐标和z坐标,以用于surf和mesh 。
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.
生成并绘制一个球体。
sphere(20)
axis('square')
or
[x,y,z]=sphere(20);
surf(x, y, z)
axis('square')
输出: