代码: ;+ ; :Author:caozhigang ;:Copyright:UCAS ;:blog:blog.sina.com.cn/ahnucao ;-
PRO PLANK_SPECTRUMCURVES;生成普朗克光谱曲线colors=['r','g','b','c','m','y','k']wavelengths=FINDGEN(1000,start = 1,increment = 0.1);1_100um radiance =CALC_OMMITRADIANCE(wavelengths,250) plots =PLOT(wavelengths,radiance,Name =STRING(250)+'K',colors[0],$ AXIS_STYLE = 1,xtitle ='wavelength(um)',ytitle ='辐射出射度/(m^2*um)') PLOTS.TITLE ='黑体辐射曲线' lege = legend(target =plots,$ /DATA, /AUTO_TEXT_COLOR) c_index =1 FOR T= 270,340,20 DOBEGIN ;计算黑体辐射出射度 radiance = CALC_OMMITRADIANCE(wavelengths,T) ;;随机产生一个颜色 ;colorNames = TAG_NAMES(!color) ;index =ROUND(RANDOMU(seed,1)*N_ELEMENTS(colorNames)+0) ;color = colorNames[index] plots = PLOT(wavelengths,radiance,Name =STRING(T)+'K',colors[c_index],$ AXIS_STYLE = 1,xtitle ='wavelength(um)',ytitle ='辐射出射度/(m^2*um)',/OVERPLOT) lege.ADD,plots c_index = c_index+1 ENDFOREND
FUNCTIONCALC_OMMITRADIANCE,wavelengths,T ;;wavelengths=FINDGEN(1000,start = 1,increment = 0.1);1_100um spectrum=FINDGEN(1000);保存强度 colors =!color c = 3*10.0^14;m/s h =6.6256*10.0^(-34);Plank statics num k =1.38*10.0^(-23);S_P statics num FOR i =0,N_ELEMENTS(wavelengths)-1 DO BEGIN ; first_factor = 2*!pi*c*c*h/(wavelengths[i]^5.0) sencond_factor = 1.0/(EXP(c*h/(k*wavelengths[i]*T))-1) spectrum[i] = first_factor *sencond_factor*10^12.0;这里乘上10^12次方,是为了将um2转换为转化为m2的单位 ENDFORRETURN,spectrumEND
效果图: