我正在尝试绘制普朗克辐射方程,如下所示。当我使用Mathematica时,它绘制得很好,但当我尝试使用Python时,我不能正确地完成它。它基本上不会绘制在~ 1.0微米波长以下。请看附件中的图片和代码。如果你能帮上忙,我将非常感激。提前谢谢你。
import matplotlib.pyplot as plt
from matplotlib import pyplot
from matplotlib import pylab
import numpy as np
h = 6.626e-34
c = 2.9979e+8
k = 1.38e-23
def planck(wav, T):
a = 2.0*3.14*h*c**2
b = h*c/(wav*1e3*1e-9*k*T)
intensity = a/ ( ((wav*1e3*1e-9)**5) * (np.exp(b) - 1.0) )*1e-6
return intensity
wavelengths = np.logspace(1e-2, 1e2, 1e4, endpoint=False)
intensity310 = planck(wavelengths, 310.)
intensity3000 = planck(wavelengths, 3000.)
intensity5800 = planck(wavelengths, 5800.)
intensity15000 = planck(wavelengths, 15000.)
plt.plot(wavelengths, intensity310, 'k-') # 5000K Black line
plt.plot(wavelengths, intensity3000, 'r-') # 5000K green line
plt.plot(wavelengths, intensity5800, 'y-') # 6000K blue line
plt.plot(wavelengths, intensity15000, 'b-') # 7000K Red line
pyplot.xscale('log')
pyplot.yscale('log')
pylab.xlim([1e-2,1e2])
pylab.ylim([1,1e10])
plt.show()使用Python的绘图

一个使用Mathematica的图

https://stackoverflow.com/questions/47861245
复制相似问题