# convdensity

Convert from density units to specified density units

## Syntax

``````convertedValues = convdensity(valuesToConvert,inputDensityUnits,outputDensityUnits)``````

## Description

example

``````convertedValues = convdensity(valuesToConvert,inputDensityUnits,outputDensityUnits)``` computes the conversion factor from specified input density units to specified output density units. The function then applies the conversion factor to the input to produce the output in the specified units. ```

## Examples

collapse all

Convert three densities from pound mass per feet cubed to kilograms per meters cubed.

`a = convdensity([0.3 0.1 0.5],'lbm/ft^3','kg/m^3')`
```a = 1×3 4.8055 1.6018 8.0092 ```

## Input Arguments

collapse all

Values to convert, specified as a floating-point array of size m-by-n. All values must have the same unit conversions from `inputDensityUnits` to `outputDensityUnits`.

Data Types: `double`

Input mass units, specified as one of these.

 `'lbm/ft^3'` Pound mass per feet cubed `'kg/m^3'` Kilograms per meters cubed `'slug/ft^3'` Slugs per feet cubed `'lbm/in^3'` Pound mass per inch cubed

Data Types: `string`

Output mass units, specified as one of these.

 `'lbm/ft^3'` Pound mass per feet cubed `'kg/m^3'` Kilograms per meters cubed `'slug/ft^3'` Slugs per feet cubed `'lbm/in^3'` Pound mass per inch cubed

Data Types: `string`

## Output Arguments

collapse all

Converted values, returned as a floating-point array of size m-by-n.

## Version History

Introduced in R2006b