Problem 56333. Air Density from Temperature and Pressure
The density of air can be estimated from the product of molar mass and molar density:
Write a function that finds the density of air in kg per cubic meter, for input temperature (in Kelvin) and pressure (in mb). This function should allow: a single input temperature and pressure pair, a single temperature and vector of pressures, a single pressure and and a vector of temperatures, a vector of pressures and a vector of temperatures of the same size (interpreted as pairs). Return -1 if a P and T are unequal vector dimensions greater than 1.
Note: convert values to
.
Note:
See Problem 56328. Molar Air Density from Temperature and Pressure for explanation of how to find the molar density of air can be found from the Temperature and Pressure using the ideal gas law.
Solution Stats
Problem Comments
-
1 Comment
Rafael S.T. Vieira
on 29 Oct 2022
Each problem should be self-contained. Requiring the users to go to different places even within the same site may create inconsistencies years later when not even you remember about it anymore.
Solution Comments
Show commentsGroup

Basic Weather 1
- 10 Problems
- 84 Finishers
- Find Air Temperature from Cricket Stridulation Rate
- Predict Cricket Stridulation Rate from Air Temperature
- Air Mass to Star for an Observer at Mean Sea Level
- Molar Air Density from Temperature and Pressure
- Air Density from Temperature and Pressure
- Pressure for a given Above Sea Level Altitude
- Partial Pressure of Water Vapor from Relative Humidity
- Calculate Wind Chill Factor
- Snow Accumulation and Structural Risks To Residential Properties
- Convert Volume Mixing Ratio to Density
Problem Recent Solvers154
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!