Spherical to Cartesian
Transform spherical coordinates to Cartesian coordinates
Libraries:
Simulink Extras /
Transformations
Description
The Spherical to Cartesian block transforms the spherical coordinates (r, theta, phi) to the Cartesian coordinates (x, y, z).
The first input is r, the second input is theta, and the third input is phi. The angles theta and phi are in radians. The first output is x, the second output is y, and the third output is z.
The spherical coordinate r is the length of the line from the origin to a point P. The spherical coordinate theta (the azimuth) is the angle measured in radians from the positive x-axis to the projection, in the x-y plane, of the line from the origin to P. The spherical coordinate phi (the zenith) is the angle, measured in radians, from the positive z-axis to the line from the origin to P. The Cartesian coordinates (x, y, z) describe the point P with respect to the x-axis, y-axis, and z-axis.
Note
The MATLAB® function cart2sph
measures phi from
the x-y plane.
x = r × sin(phi) × cos(theta)
y = r × sin(phi) × sin(theta)
z = r × cos(phi)
Note
The notation for spherical coordinates might differ from that used in other references. Sometimes, the order of theta and phi is reversed. Sometimes, theta denotes the zenith and phi denotes the azimuth.
Ports
Input
Output
Version History
Introduced in R2008b