# simscape.computationalUnit

Determine computational unit for commensurate units

## Description

example

cu = simscape.computationalUnit(unitlist) returns the computational unit for a set of units specified by unitlist. Computational unit is the common unit used for certain math operations on operands with commensurate units. For more information, see Computational Units.

All arguments in the list must have commensurate units. The function returns the computational unit cu as a scalar simscape.Unit object.

## Examples

collapse all

Create simscape.Value objects with commensurate units:

v1 = simscape.Value([100, 200, 300], "mm");
v2 = simscape.Value(10, "cm");
v3 = simscape.Value(1, "ft");

Determine the computational unit for the first two objects:

cu = simscape.computationalUnit(v1,v2)
cu =

cm

Computational unit is the unit with the largest conversion factor to the fundamental unit. The fundamental unit for length is m. The conversion factor of cm into m is larger than that of mm into m, therefore, the function returns cm.

Now determine the computational unit for all three objects:

cu = simscape.computationalUnit(v1,v2,v3)
cu =

ft

The conversion factor of ft into m is larger than that of cm or mm, therefore, the function now returns ft.

You can also specify the input arguments as strings, character vectors, or scalar simscape.Unit objects. For example:

cu = simscape.computationalUnit(v1,v2,"in")
cu =

in

## Input Arguments

collapse all

List of units of potential operands, specified as character vectors, strings, scalar simscape.Unit objects, or simscape.Value objects. For simscape.Value objects, the function uses the unit of the object. All units must be commensurate. The list cannot contain affine units, such as degC or degF.

## Version History

Introduced in R2021b