function n=edlen_index(wave,temp,press,rh)

% Calculation of index of refraction of air using the Edlen equation
% Units:  wave - micrometers
%         temp - celsius
%         press - pascal
%         rh - relative humidity

%constants
A=8342.54;
B=2406147;
C=15998;
D=96095.43;
E=0.601;
F=0.00972;
G=0.003661;

pv=(rh/100)*psv(temp);
S=wave^-2;
ns=1+1e-8*(A + B/(130 - S) + C/(38.9 - S));
X=(1+1e-8*(E-F*temp)*press)/(1 + G*temp);
ntp=1+press*(ns-1)*X/D;
n=ntp-(1e-10)*((292.75)/(temp+273.15))*(3.7345-0.0401*S)*pv
end