# sphere_to_cart (MathScript RT Module Function)

LabVIEW 2012 MathScript RT Module Help

Edition Date: June 2012

Part Number: 373123C-01

»View Product Info Download Help (Windows Only)

Owning Class: basic

Requires: MathScript RT Module

## Syntax

[x, y, z] = sphere_to_cart(a, b, c)

Legacy Name: `sph2cart`

## Description

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

Details

Examples

## Inputs

Name Description
a Specifies the azimuthal angles, or the angles measured from the x-axis to the data points projected in the xy-plane. a is a matrix.
b Specifies the elevation angles, or the angles measured from the xy-plane to the data points. b is a matrix of the same size as a.
c Specifies the radii. c is a matrix of the same size as a.

## Outputs

Name Description
x Returns the x-coordinates. x is a matrix of the same size as a.
y Returns the y-coordinates. y is a matrix of the same size as a.
z Returns the z-coordinates. z is a matrix of the same size as the smallest of a, b, and c.

## Details

LabVIEW 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)

The following table lists the support characteristics of this function.

 Supported in the LabVIEW Run-Time Engine Yes Supported on RT targets Yes Suitable for bounded execution times on RT Not characterized

## Examples

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