Table Of Contents

cart_to_sphere

Version:
    Last Modified: December 12, 2016

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

    Syntax

    [a, b, c] = cart_to_sphere(x, y, z)
    Legacy name: cart2sph

    Inputs

    x

    X-coordinates. x is a scalar or an array of any dimension of floating-point or real numbers.

    y

    Y-coordinates. y is a scalar or an array of any dimension of floating-point or real numbers of the same shape as x.

    z

    Z-coordinates. z is a scalar or an array of any dimension of floating-point or real numbers of the same shape as x.

    Outputs

    a

    Azimuthal angles, or the angles measured from the x-axis to the data points projected in the xy-plane. a is an array of the same size as the maximum shape of x, y, and z.

    b

    Elevation angles, or the angles measured from the xy-plane to the data points. b is an array of the same size as the maximum shape of x, y, and z.

    c

    Radii of the spherical data. c is an array of the same size as the maximum shape of x, y, and z.

    Transformation Equations

    MathScript performs the transformation using the following equations:

    a = atan2(y, x)

    b = atan2(z, sqrt(x.^2+y.^2))

    c = sqrt(x.^2+y.^2+z.^2)

    [A, B, C] = cart_to_sphere(1, 1, 1)

    Where This Node Can Run:

    Desktop OS: Windows

    FPGA: DAQExpress does not support FPGA devices


    Recently Viewed Topics