Density profile in the atmosphere, which equations to use...? I came across the following density profile in the atmosphere:
 T_0 = 288.16; %sea level temperature (kelvin)

 rho_0 = 1.225; %sea level density (kg/m^3)

 a = -0.0065; %lapse rate (K/m)

 R = 287.05; %gas constant (J/kg*K)

den = [];

for h = 1:11000

    T = T_0 + a*h;

    den(h) = rho_0 * (T/T_0)^((-g_0/(a*R)) - 1 );

end

T_isot = 217; %isothermal temp (K)

for h = 11001:13000

   den(h) = den(11000) * (exp(1))^((-g_0/(T_isot*R))* (h-11000));

end

Here's what I'm typically used to, derived form the ideal gas law:
$$p(h)=P(h)/(R*T(h))$$ where $$P(h) = P_0*exp(-(h/h_0))$$
My expression seems to be much simpler...so which ones do you like, and why? I'm trying to decide which to use in an experiment...
And what would you recommend for $T(h)$? as you can see, above they use a linear gradient and an isothermal assumption....
 A: I calculated the shape of the two expressions, and looked at the difference. I also plotted the difference if you used linear interpolation from the data in the table you linked in the comments (data points shown in red dots on the first plot):

I suppose it all depends how much you care about the difference... 6% seems quite a big difference (it will be smaller over a smaller range; and I calculated h_0 by fitting the data, and you might have a value that works better over a narrow range of heights). Clearly, even linear interpolation with data spaced by 2 km gives a much better agreement with the "complex" model; if you used a higher order interpolation (quadratic, cubic), the error would be tiny.
Incidentally in your Matlab code, the line 
den(h) = den(11000) * (exp(1))^((-g_0/(T_isot*R))* (h-11000));

can of course be written as
den(h) = den(11000) * exp(-g_0/(T_isot*R) * (h-11000));

And as a further aside, you really want to initialize your Matlab arrays to the size you want them to end up as - otherwise, you will slow your code very significantly (it keeps resizing and potentially moving the array as it gets bigger). So just add
den = zeros(1,13000);

There are other ways to make that density calculation a lot more compact...
