function [Td] = dp(Ta,rh) % This MATLAB function computes the dew point tempearture. % Formula from Wikipedia. % Claims accuracy of +-0.4 deg C. % Valid for 0 deg C < Ta < 100 deg C. % % Input: Ta = air temperature in deg C (can be a vector). % rh = relative humidity in percent. % Output: Td = dew point temperature in dec C (vector if Ta is a vector). % % Brian Hornbuckle, November 23, 2006. % ---------------------------------------------------- % change relative humidity to fraction rh = rh./100; % calculate gamma factor a = 17.27; b = 237.7; gamma = a.*Ta./(b + Ta) + log(rh); % calculate dew point temperature Td = b.*gamma./(a - gamma);