convdensity

Convert from density units to desired density units

Syntax

convertedValues = convdensity(valuesToConvert, inputDensityUnits, outputDensityUnits)

Description

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

Input Arguments

valuesToConvert

Floating-point array of size m-by-n values that the function is to convert. All values must have the same unit conversions from inputDensityUnits to outputDensityUnits.

inputDensityUnits

Specified input density units, as strings. Supported unit strings are:

'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

outputDensityUnits

Specified output density units, as strings. Supported unit strings are:

'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

Output Arguments

convertedValues

Floating-point array of size m-by-n values that the function has converted.

Examples

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 =

    4.8055    1.6018    8.0092
Was this topic helpful?