公式

python程序
import numpy as np
import matplotlib.pyplot as plt
def planck_formula(wavelength,
temperature,
c1=3.7414*10**8,
c2=1.43879*10**4
):
return (c1/wavelength**5)*(1/(np.e**(c2/wavelength/temperature)-1))
wavelength_limit = np.linspace(0.001,100,100000)
out_500 = planck_formula(wavelength_limit,500)
out_800 = planck_formula(wavelength_limit,800)
plot_500 = plt.plot(wavelength_limit,out_500,label='500K')
plot_800 = plt.plot(wavelength_limit,out_800,label='800K')
plt.xlim(0,20)
plt.ylim(0,8000)
plt.xlabel('wavelength: μm')
plt.ylabel('spectral radiant emission: w/(cm^2 * μm)')
plt.title('Blackbody spectral radiant emission curve:')
plt.legend()
plt.show()
结果

matlab程序
function IRwork1()
function emission = planck_formula(wavelength,temperature)
c1=3.7414*10^8;
c2=1.43879*10^4;
emission = (c1./(wavelength().^5)).*(1./(exp(c2./wavelength./temperature)-1));
end
wavelength = 0.1:0.01:25;
out_500 = planck_formula(wavelength,500);
out_800 = planck_formula(wavelength,800);
plot(wavelength,out_500);
hold on;
plot(wavelength,out_800);
title('Blackbody spectral radiant emission curve:');
end
结果
