[theta,rho]
= cart2pol(x,y) transforms
corresponding elements of the two-dimensional Cartesian coordinate
arrays x and y into polar coordinates theta and rho.
Convert the three-dimensional Cartesian coordinates defined by corresponding entries in the matrices x, y, and z to cylindrical coordinates theta, rho, and z.
x, y, z — Cartesian coordinates scalars | vectors | matrices | multidimensional arrays
Cartesian coordinates, specified as scalars, vectors, matrices,
or multidimensional arrays. x, y,
and z must be the same size, or any of them can
be scalar.
Angular coordinate, returned as an array. theta is the counterclockwise
angle in the
x-y plane
measured in radians from the positive
x-axis. The value of the angle
is in the range [-pi
pi].
rho — Radial coordinate array
Radial coordinate, returned as an array. rho is
the distance from the origin to a point in the x-y plane.
z — Elevation coordinate array
Elevation coordinate, returned as an array. z is
the height above the x-y plane.
Algorithms
The mapping from two-dimensional Cartesian coordinates to polar
coordinates, and from three-dimensional Cartesian coordinates to cylindrical
coordinates is
Extended Capabilities
Tall Arrays Calculate with arrays that have more rows than fit in memory.
This function fully supports tall arrays. For
more information, see Tall Arrays.
C/C++ Code Generation Generate C and C++ code using MATLAB® Coder™.
GPU Code Generation Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.
GPU Arrays Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Distributed Arrays Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™.