File Exchange

image thumbnail


version (242 KB) by Felipe G. Nievinski
Convert humidity between different formats.


Updated 16 Apr 2011

View License

Convert humidity between any two of the following formats:
- partial pressure of water vapor
- specific humidity
- mixing ratio
- relative humidity
- dew point temperature
- virtual temperature

Cite As

Felipe G. Nievinski (2020). convert_humidity (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (9)

Riley Toll

peng bai

When I wrote a function based on the equations on the books, I also get RH values larger than 100%, even up to 175%. The RH values are similar with that by Felipe's function, I mean, this program should be at least theoretically right.

peng bai

RH from this function can be over 100%....


@Andre: garbage in, garbage out? Please specify your input.


This code is crap. RH values should not exceed 100% by more than 1% ever. Thanks but no thanks

Felipe G. Nievinski

@hosseini: please take a look at the tests included in the bottom of file convert_humidity.m. For example, to convert specific humidity (s) to relative humidity (r) you'd do:
r = convert_humidity (P, T, s, 'specific humidity', 'relative humidity');
where P and T stands for pressure and temperature.


dear Felipe
I added the functions to my MATLAB but I don't know how to use the functions and syntaxes.Please help me.



I used this function to convert from specific humidity to relative humidity. A few of my values (about 6%) were above 100% relative humidity. The data I am using is straight from CMIP5, and has not been altered. All the variables are in the correct units. Any idea why I have impossible above 100% values?????? (there are some that are 100.2% and others that are 120%). The rest of the values look normal around 60 - 90 percent.


Included PDF describing formulation; applied more tags.

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