Coordinate System Mapping Functions
• xy2pol(x, y) or xy2pol(v)—Converts the rectangular coordinates of a point (x, y) to polar coordinates (r, θ).
• pol2xy(r, θ) or pol2xy(v)—Converts the polar coordinates of a point (r, θ) to rectangular coordinates (x, y).
• xyz2sph(x, y, z) or xyz2sph(v)—Converts the rectangular coordinates of a point (x, y, z) to spherical coordinates (r, θ, φ).
• sph2xyz(r, θ, φ) or sph2xyz(v)—Converts the spherical coordinates of a point (r, θ, φ) to rectangular coordinates (x, y, z).
• xyz2cyl(x, y, z) or xyz2cyl(v)—Converts the rectangular coordinates of a point (x, y, z) to cylindrical coordinates (r, θ, φ).
• cyl2xyz(r, θ, z) or cyl2xyz(v)—Converts the cylindrical coordinates of a point (r, θ, z) to rectangular coordinates (x, y, z).
Each function returns a three-element column vector with the new coordinates. Angles are given in radians.
The
sph2xyz and
cyl2xyz functions are useful as the last argument to
CreateMesh and
CreateSpace.
Arguments
• x, y, z, r, θ, φ are real numbers. If you do not add the degree operator, the angle θ is interpreted to be an angle in radians.
• v is a two or three-element vector giving the coordinates to transform in the alternate argument structure of these functions.