# cart_to_polar

Version:

Transforms 2D or 3D Cartesian coordinates into polar or cylindrical data, respectively. cart_to_polar performs an element-wise transformation for arrays.

## Syntax

[a, b] = cart_to_polar(x, y)
[a, b, c] = cart_to_polar(x, y, z)
Legacy name: cart2pol

## x

X-coordinates. x is a scalar or an array of any dimension of floating-point or real numbers. If x, y, and z are not scalars, they must have the same shape.

## y

Y-coordinates. y is a scalar or an array of any dimension of floating-point or real numbers. If x, y, and z are not scalars, they must have the same shape.

## z

Z-coordinates. z is a scalar or an array of any dimension of floating-point or real numbers. If x, y, and z are not scalars, they must have the same shape.

## a

Angles of the polar or cylindrical data. a is an array of the same size as the maximum shape of x, y, and z.

## b

Radii of the polar or cylindrical data. b is an array of the same size as the maximum shape of x, y, and z.

## c

Heights of the cylindrical data. c is an array of the same size as the maximum shape of x, y, and z.

## 2D and 3D Coordinates

If you provide 2D coordinates, MathScript performs the transformation using the following equations:

a = atan2(y, x)

b = sqrt(x. ^2+y.^2)

If you provide 3D coordinates, MathScript performs the transformation using the following equations:

a = atan2(y, x)

b = sqrt(x.^2+y.^2)

c = z

[A, B, C] = cart_to_polar(1, 1, 1)

Where This Node Can Run:

Desktop OS: Windows

FPGA: This product does not support FPGA devices