Use the cylindrical coordinate system to find the formulas f
Solution
[theta,rho] = cart2pol(x,y)
[theta,rho,z] = cart2pol(x,y,z).
[theta,rho] = cart2pol(x,y) transforms corresponding elements of the two-dimensional Cartesian coordinate arrays x and y into polar coordinates theta and rho.
[theta,rho,z] = cart2pol(x,y,z) transforms three-dimensional Cartesian coordinate arrays x, y, and z into cylindrical coordinates theta, rho, and z.
for generating sphere:
sphere
sphere(n)
sphere(ax,...)
[X,Y,Z] = sphere(...)
The sphere function generates the x-, y-, and z-coordinates of a unit sphere for use with surf and mesh.
sphere generates a sphere consisting of 20-by-20 faces.
sphere(n) draws a surf plot of an n-by-n sphere in the current figure.
sphere(ax,...) creates the sphere in the axes specified by ax instead of in the current axes. Specify ax as the first input argument.
[X,Y,Z] = sphere(...) returns the coordinates of the n-by-n sphere in three matrices that are (n+1)-by-(n+1) in size. You draw the sphere with surf(X,Y,Z) or mesh(X,Y,Z).
