sphere_to_cart

Version:

Converts spherical data into 3D Cartesian data. This function works element-wise for arrays.

Syntax

[x, y, z] = sphere_to_cart(a, b, c)
Legacy name: sph2cart

a

Azimuthal angles or the angles measured from the x-axis to the data points projected in the xy-plane. a is a scalar or an array of any dimension of floating-point or real numbers.

b

Elevation angles or the angles measured from the xy-plane to the data points. b is a scalar or an array of any dimension of floating-point or real numbers of the same shape as a.

c

Radii. c is a scalar or an array of any dimension of floating-point or real numbers of the same shape as a.

x

X-coordinates. x is an array of the same size as the maximum shape of a, b, and c.

y

Y-coordinates. y is an array of the same size as the maximum shape of a, b, and c.

z

Z-coordinates. z is an array of the same size as the maximum shape of a, b, and c.

Calculation of a, b, and c

MathScript computes a, b, and c using the following equations:

x = c.*cos(a).*cos(b)

y = c.*sin(a).*cos(b)

z = c.*sin(b)

[X, Y, Z] = sphere_to_cart(1, 1, 1)

Where This Node Can Run:

Desktop OS: Windows

FPGA: DAQExpress does not support FPGA devices