RELHUMID: finds relative humidity from wet/dry thermometer readings. rh=relhumid(Td,Tw,Pa,type) computes the relative humidity from wt and dry-bulb temperature measurements using the psychrometric eqn. and constants from Sargent (1980), Meteorol. Mag. 109, 238-246. The latter two inputs are optional. INPUTS : Td - dry bulb thermometer [C] Tw - wet thermometer [C] Pa - air pressure (optional) [mb] type - 'assman' for Assman-type forced ventilation 'screen' for standard screen (natural ventilation) OUTPUT: rh - relative humidity [%]
0001 function rh=relhumid(Td,Tw,P,p_typ) 0002 % RELHUMID: finds relative humidity from wet/dry thermometer readings. 0003 % rh=relhumid(Td,Tw,Pa,type) computes the relative humidity from 0004 % wt and dry-bulb temperature measurements using the psychrometric eqn. 0005 % and constants from Sargent (1980), Meteorol. Mag. 109, 238-246. The 0006 % latter two inputs are optional. 0007 % 0008 % INPUTS : Td - dry bulb thermometer [C] 0009 % Tw - wet thermometer [C] 0010 % Pa - air pressure (optional) [mb] 0011 % type - 'assman' for Assman-type forced ventilation 0012 % 'screen' for standard screen (natural ventilation) 0013 % 0014 % OUTPUT: rh - relative humidity [%] 0015 0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0017 % 8/28/98: version 1.1 (contributed by RP) 0018 % 8/5/99: version 2.0 0019 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0020 0021 as_consts; 0022 0023 if nargin==2, 0024 P=P_default; 0025 p_typ=psych_default; 0026 elseif nargin==3, 0027 if isstr(P), 0028 p_typ=P; 0029 P=P_default; 0030 else 0031 p_typ=psych_default; 0032 end; 0033 end; 0034 0035 % psychrometric coefficient 0036 0037 switch p_typ, 0038 case 'screen', 0039 A=0.000799; % natural screens 0040 case 'assman', 0041 A = 0.000667; % Assmann-type with forced ventilation 0042 otherwise 0043 error(['unknown psychrometer type: ' p_typ]); 0044 end; 0045 0046 % compute saturation vapour pressure for both temps. 0047 ed=satvap(Td,P); 0048 ewp=satvap(Tw,P); 0049 0050 % The psychrometric eqn! 0051 e = ewp - A*P.*(Td-Tw); % ambient vapour pressure 0052 0053 rh= e./ed * 100; 0054