网络编程
位置:首页>> 网络编程>> Python编程>> Python超越函数积分运算以及绘图实现代码

Python超越函数积分运算以及绘图实现代码

作者:Hades_Asg  发布时间:2021-04-07 09:41:45 

标签:Python,超越函数,积分运算,绘图

编译环境:ubuntu17.04 Python3.5

所需库:numpy、scipy、matplotlib

下面是理想平面的辐射强度计算(课程大作业~~~)

1、超越函数积分运算


def integral(x,c1,c2,T):
 return ((c1*0.98)/(x**5))*(1/((np.e**(c2/(x*T)))-1))

resut,err = integrate.quad(integral, 3, 5, args=(c1,c2,T))

2、绘图实现


plt.figure(1)
ax1 = plt.subplot(211)
plt.sca(ax1)
plt.plot(fi,functionI(fi,0.5,5,1,e0),label='n=5,ks=0.5')
plt.legend(loc='upper right',bbox_to_anchor = (0.9, 0.9))
plt.xlabel(u'ψ/rad')
plt.ylabel(u'I/(W/sr)')

ax2 = plt.subplot(212)
plt.sca(ax2)
plt.plot(fi,functionI(fi,0.5,5,1,e0),label='n=5,ks=0.5')
plt.legend(loc='upper right',bbox_to_anchor = (0.9, 0.9))
plt.xlabel(u'ψ/rad')
plt.ylabel(u'I/(W/sr)')

plt.subplots_adjust(wspace=0.5, hspace=0.5)
plt.show()

说一下plt.subplots_adjust这个函数,这个是用来调整子图之间的间距的啦

成果图:

Python超越函数积分运算以及绘图实现代码

来源:https://blog.csdn.net/weixin_35977061/article/details/72742605

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com