# cart2pol

Converts Cartesian coordinates to polar or cylindrical.

## Syntax

[theta,r] = cart2pol(x,y)

[theta,r,z] = cart2pol(x,y,z)

[theta,r] = cart2pol(C)

[theta,r,z] = cart2pol(C)

P = cart2pol(...)

## Inputs

`x,y,z`- Cartesian coordinates.
`C`- An array or matrix containing Cartesian coordinates.

## Outputs

- theta
- The angle measured from the positive x-axis.
- r
- The distance between the point and the z-axis.
- z
- The z coordinate.
- P
- A matrix containing theta, r, and z (if specified).

## Examples

Single return cart2pol polar example:

`P=cart2pol(3,4)`

```
P = [Matrix] 1 x 2
0.92730 5.00000
```

Multiple return cart2pol cylindrical example:

`[theta,r,z]=cart2pol(3,4,5)`

```
theta = 0.927295218
r = 5
z = 5
```

## Comments

When a matrix contains multiple points the coordinates are stored by row.