File Exchange

## Air density calculation

version 1.0.0.0 (1.15 KB) by Jose Luis Prego

### Jose Luis Prego (view profile)

This function calculates the density of the air

Updated 05 Feb 2007

This function calculates the air-density based on the papers:

1)'Equation for the Determination of the Density of Moist Air'
P.Giacomo, Metrologia 18, 33-40 (1982)

2)'Equation for the Determination of the Density of Moist Air'
R.S. Davis Metrologia 29, 67-70 (1992)

Parameters:
t = ambient temperature (ºC)
hr = relative humidity [%]
p = ambient pressure [Pa]

ver 1.0
06/10/2006 Jose Luis Prego Borges
Sensor & System Group, Universitat Politecnica de Catalunya, Spain

### Cite As

Jose Luis Prego (2020). Air density calculation (https://www.mathworks.com/matlabcentral/fileexchange/12565-air-density-calculation), MATLAB Central File Exchange. Retrieved .

### Comments and Ratings (10)

Diego Fraguas Tejero

Kim DiGiovanni

### Kim DiGiovanni (view profile)

Excellent! Easy to use and well developed and cited!

Kim DiGiovanni

Olfert

### Olfert (view profile)

missing the temperature and pressure limitations for this function?

I tried to use it to get air density in a simulation of a combustion engine with 1>=hr>=0, but it seems that after 3.5e6Pa and 1500K the function doesn't work. It returns negatives densities. I guess thats the limitations, just so it is here.

other wise great function :D

riva wahyudi

good for reference tehnical specification

riva wahyudi

good

paramust juntarakod

thank you for your work

Niclas -

Good work! Although the difference is minor, the correct conversion between degrees Celsius and Kelvin is:

t90 / °C = T90/K - 273.15

Check the ITS-90 page on:
http://www.its-90.com/its-90.html

Best regards,
niclas

Nanthakarn Udomputtisit

Jos x

Why not vectorize it so you can put in a list of numbers? (simply use .* instead of * etc.)
Why is f0 in the argument list?
The help should mention what "ro" is and in what units it is expressed.
End the calculations with a semi-colon to suppress the display.
For some (most) values ro is negative? Can that be true?
You should check for unphysical inputs (e.g., hr>100%).