Transform polar or cylindrical coordinates to Cartesian (2024)

Transform polar or cylindrical coordinates to Cartesian

collapse all in page

Syntax

[x,y] =pol2cart(theta,rho)

[x,y,z]= pol2cart(theta,rho,z)

Description

example

[x,y] =pol2cart(theta,rho) transformscorresponding elements of the polar coordinate arrays theta and rho totwo-dimensional Cartesian, or xy, coordinates.

example

[x,y,z]= pol2cart(theta,rho,z) transformscorresponding elements of the cylindrical coordinate arrays theta, rho,and z to three-dimensional Cartesian, or xyz,coordinates.

Examples

collapse all

Polar to Cartesian Coordinates

Open Live Script

Convert the polar coordinates defined by corresponding entries in the matrices theta and rho to two-dimensional Cartesian coordinates x and y.

theta = [0 pi/4 pi/2 pi]
theta = 1×4 0 0.7854 1.5708 3.1416
rho = [5 5 10 10]
[x,y] = pol2cart(theta,rho)
x = 1×4 5.0000 3.5355 0.0000 -10.0000
y = 1×4 0 3.5355 10.0000 0.0000

Cylindrical to Cartesian Coordinates

Open Live Script

Convert the cylindrical coordinates defined by corresponding entries in the matrices theta, rho, and z to three-dimensional Cartesian coordinates x, y, and z.

theta = [0 pi/4 pi/2 pi]'
theta = 4×1 0 0.7854 1.5708 3.1416
rho = [1 3 4 5]'
rho = 4×1 1 3 4 5
z = [7 8 9 10]'
z = 4×1 7 8 9 10
[x,y,z] = pol2cart(theta,rho,z)
x = 4×1 1.0000 2.1213 0.0000 -5.0000
y = 4×1 0 2.1213 4.0000 0.0000
z = 4×1 7 8 9 10

Input Arguments

collapse all

thetaAngular coordinate
scalar | vector | matrix | multidimensional array

Angular coordinate, specified as a scalar, vector, matrix, or multidimensional array. theta, rho, and z must be the same size, or have sizes that are compatible (for example, theta is an M-by-N matrix, rho is a scalar, and z is a scalar or 1-by-N row vector). For more information, see Compatible Array Sizes for Basic Operations.

theta is the counterclockwise angle in the x-y planemeasured in radians from the positive x-axis.

Data Types: single | double
Complex Number Support: Yes

rhoRadial coordinate
scalar | vector | matrix | multidimensional array

Radial coordinate, specified as a scalar, vector, matrix, or multidimensional array. theta, rho, and z must be the same size, or have sizes that are compatible.

rho is the distance from the origin to apoint in the x-y plane.

Data Types: single | double
Complex Number Support: Yes

zElevation coordinate
scalar | vector | matrix | multidimensional array

Elevation coordinate, specified as a scalar, vector, matrix, or multidimensional array. theta, rho, and z must be the same size, or have sizes that are compatible.

z is the height above the x-y plane.

Data Types: single | double
Complex Number Support: Yes

Output Arguments

collapse all

x, y, z — Cartesian coordinates
arrays

Cartesian coordinates, returned as arrays.

Algorithms

The mapping from polar and cylindrical coordinates to Cartesiancoordinates is:

Transform polar or cylindrical coordinates to Cartesian (1)

Extended Capabilities

This function fully supports tall arrays. Formore information, see Tall Arrays.

GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.

This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).

Version History

Introduced before R2006a

See Also

cart2pol | cart2sph | sph2cart

MATLAB Command

You clicked a link that corresponds to this MATLAB command:

 

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Transform polar or cylindrical coordinates to Cartesian (2)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

Contact your local office

Transform polar or cylindrical coordinates to Cartesian (2024)
Top Articles
Latest Posts
Article information

Author: Carlyn Walter

Last Updated:

Views: 6536

Rating: 5 / 5 (70 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Carlyn Walter

Birthday: 1996-01-03

Address: Suite 452 40815 Denyse Extensions, Sengermouth, OR 42374

Phone: +8501809515404

Job: Manufacturing Technician

Hobby: Table tennis, Archery, Vacation, Metal detecting, Yo-yoing, Crocheting, Creative writing

Introduction: My name is Carlyn Walter, I am a lively, glamorous, healthy, clean, powerful, calm, combative person who loves writing and wants to share my knowledge and understanding with you.