File Exchange

image thumbnail

Ideal Air Properties

version (9.03 KB) by Jared Miller
Interpolates and outputs air properties that follow the ideal gas law given an input value.


Updated 14 Aug 2009

View License

This program interpolates air properties following the Ideal Gas Law from the gas table A22 and A22e in the textbook Fundamentals of Engineering Thermodynamics by Moran, Shapiro (6th edition)

Cite As

Jared Miller (2020). Ideal Air Properties (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (21)

Nate Li

This code is easy to follow thanks to the many comments left by the author. At times, it can be confusing which units are being outputted if the user is not looking at the function. We took one star away because it could be more user friendly, but the code is accurate and runs properly.

Tanvi Rao

The code was concise, efficient and performed all of the expected tasks. Overall, the code worked well, however, there are slight improvements that could be made. Some improvements that would increase the quality of the code are: keeping significant figures consistent between the input and output values, as well as keeping the decimal places consistent between the textbook table and the code table to reduce rounding error in the interpolated values.

The code worked well and was easy to follow. The small errors in the data tables occasionally caused incorrect interpolated points, but overall the output appeared very accurate. Some additional updates to the function would be helpful.

Jessie Sun

Alex Marks

A simple addition to this program makes it much more useful. Add "IdealAir = " between "function" and "IdealAir(...)" to have the value be returned and usable

Alex Marks

What are the units of relative pressure?

The code works well and is easy to use. As everyone else has mentioned, there are some errors in the tables.

The code is clean and simple. It allows for the calculation of several thermodynamic values provided that another significant value is known. The data has some errors, however, as noted by other commenters. This is very useful and well-written code, but could use an update.


I checked the SI table, apart from the errata found by skewcrap, I found that the table

- Is missing rows of T = 770 and T = 790.
- At T = 1800, vr = 3.944

How to write code?


second error found:

h(T=550K) should be 554.74


there is an error in the tabulated enthalpy values:

h(T=630K) = 683.63 is WRONG
it should be 638.63


I get error
>> IdealAir
Error using IdealAir (line 58)
Not enough input arguments.

do I have to input the table myself?
where can I get the table with numbers in them? I am referring to the access file:
a22eng, a22si


To allow the output of a variable:

"Simply change the first line of code so that the output is the value
which is found.

function IdealAir=IdealAir(xi,prop1,prop2,unit)

And you can comment out the last line which simply displays the unit on

%displays on screen (optional step)
% disp([prop2,' = ',num2str(IdealAir)]); "

MATLAB Release Compatibility
Created with R2007a
Compatible with any release
Platform Compatibility
Windows macOS Linux