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

yipeiwu_com6年前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超越函数积分运算以及绘图实现代码就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持【听图阁-专注于Python设计】。

相关文章

python开发环境PyScripter中文乱码问题解决方案

PyScripter看起来还是挺不错的一个python ide 环境: PyScripter 2.6.0.0 python3.4 问题: PyScripter有个小坑,打开文件后中文都成...

对Python中实现两个数的值交换的集中方法详解

如下所示: #定义两个数并赋值 x = 1 y = 2 #第1种方式:引入第三方变量 z = 0 z = x x = y y = z #第2种:不引入第三方变量 x = x+y...

用 Python 爬了爬自己的微信朋友(实例讲解)

用 Python 爬了爬自己的微信朋友(实例讲解)

最近几天干啥都不来劲,昨晚偶然了解到 Python 里的 itchat 包,它已经完成了 wechat 的个人账号 API 接口,使爬取个人微信信息更加方便。鉴于自己很早之前就想知道诸如...

在python中使用requests 模拟浏览器发送请求数据的方法

如下所示: import requests url='http://####' proxy={'http':'http://####:80'} headers={ "Accep...

pycharm编写spark程序,导入pyspark包的3中实现方法

一种方法: File --> Default Setting --> 选中Project Interpreter中的一个python版本-->点击右边锯齿形图标(设置)...