Method on @sym: [x, y] = pol2cart (theta, r)
Method on @sym: [x, y, z] = pol2cart (theta, r, z)
Method on @sym: [x, y] = pol2cart (P)
Method on @sym: [x, y, z] = pol2cart (P)

Transform symbolic polar or cylindrical coordinates into Cartesian.

If called with inputs theta, r (and z), they must be of the same shape or a scalar. The shape of the outputs x, y (and z) matches those of the inputs (except when the input is a scalar).

If called with a single input P, it must be a column vector with 2 or 3 entries, or a matrix with 2 or 3 columns. The column vector or each row of the matrix represents a point in polar or cylindrical coordinates (theta, r) or (theta, r, z). If input P is a column vector, outputs x, y (and z) are scalars. Otherwise, the shape of the outputs x, y (and z) is a column vector with each row corresponding to that of the input matrix P.

Given a point (theta, r) in polar coordinates, its corresponding Cartesian coordinates can be obtained by:

syms theta r real
[x, y] = pol2cart (theta, r)
  ⇒ x = (sym) r⋅cos(θ)
    y = (sym) r⋅sin(θ)

Similarly, given a point (theta, r, z) in cylindrical coordinates, its corresponding Cartesian coordinates can be obtained by:

syms theta r z real
[x, y, z] = pol2cart (theta, r, z)
  ⇒ x = (sym) r⋅cos(θ)
    y = (sym) r⋅sin(θ)
    z = (sym) z

See also: pol2cart, cart2pol, cart2sph, sph2cart.

Package: symbolic