PO_matlab
|
Converts Cartesian coordinates to spherical coordinates. More...
Functions | |
function | mycart2sph (in x, in y, in z) |
Converts Cartesian coordinates to spherical coordinates.
Given Cartesian coordinates (x, y, z), this function computes the corresponding spherical coordinates: radial distance r, elevation angle theta, and azimuthal angle phi. Handles edge cases such as r = 0 to avoid NaN values in theta.
x | X-coordinate(s) |
y | Y-coordinate(s) |
z | Z-coordinate(s) |
r | Radial distance(s) from the origin |
theta | Elevation angle(s) [rad], 0 along +z |
phi | Azimuthal angle(s) [rad], 0 along +x |
function mycart2sph | ( | in | x, |
in | y, | ||
in | z ) |