function out = h_nat_dT(T,Tamb,L) % Derivative with respect of T of the function h_nat. % Air properties. k = 2e-2; % Thermal condunctivity [W/(m*K)]. rho = 1; % Density [kg/m^3]. cp = 1e3; % Heat capacity [J/(kg*K)]. mu = 1e-6; % Dynamic viscosity [Pa*s]. g = 9.81; % Gravity [m/s^2]. Pr = cp*mu/k; Ra = 2*g*rho^2*cp/(mu*k)*abs((T-Tamb)./(T+Tamb)+eps).*L.^3; Ra_dT = 2*g*rho^2*cp/(mu*k)*L.^3*2.*Tamb./(T+Tamb).^2; num = 387e-3*Ra.^(1/6); num_dT = 387e-3/6*Ra.^(-5/6).*Ra_dT; denom = (1+(492e-3/Pr)^(9/16))^(8/27); Nu_dT = num_dT.*(2*825e-3+2*num/denom)/denom; out = k.*Nu_dT./L;