function [sigma,dnu,dwave,errornum]=diff_backscatter(wavelength,temperature,rot_state,stokes,species)
frequency=1e7/wavelength;

if stokes==-1
    if rot_state<2
        errornum=2;
        disp('Anti-Stokes rotational quantum state must be >1')
        return
    end
end
if rot_state<0
    errornum=1;
    disp('Rotational quantum state must be positive')
    return
end
% constants
hc=1.98644568e-25;
c=2.99792458e8;
k=1.380649e-23;

% rename variables
J=rot_state;
T=temperature;

switch species
    case 'oxygen'
        B=1.43768;
        I=0;
        if rem(rot_state,2)==0
            g=0;
        else
            g=1;
        end
        D=4.85e-6;
        gammaterm=1.27e-60;
    case 'nitrogen'
        B=1.98957;
        I=1;
        if rem(rot_state,2)==0
            g=6;
        else
            g=3;
        end
        D=5.76e-6;
        gammaterm=0.51e-60;
end

errornum=0;
        
a1=112*pi^4/15;
E=(B*J*(J+1)-D*J*J*(J+1)^2)*hc;
if stokes==1
    X=(J+1)*(J+2)/(2*J+3);
    dnu=-B*2*(2*J+3)+D*(3*(2*J+3)+(2*J+3)^3);
else
    X=J*(J-1)/(2*J-1);
    dnu=B*2*(2*J-1)+D*(3*(2*J-1)+(2*J-1)^3);
end

nu=frequency+dnu;
dwave=1e07/nu;
sigma=a1*1.e-10 *((hc*B)/(k*T*((2*I+1)^2)))*g*X*(nu^4)*gammaterm*exp(-100*E/(k*T));

