Skip to content

cart2pol

general · scripts/general/cart2pol.m

: [theta, rho] = cart2pol (x, y)
: [theta, rho, z] = cart2pol (x, y, z)
: P = cart2pol (…)

Convert Cartesian coordinates to polar or cylindrical coordinates.

theta is the angle from the positive x axis in radians (range [-pi, pi]), rho the distance from the origin (or z axis). x, y (and z) must be real floating point arrays of the same size, or scalars. With a single output the result is the matrix [theta(:), rho(:)] (plus z(:) for three inputs).

A single matrix argument with two or three columns is also accepted; its rows are the points.