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 中的多线程 新手必看

示例1 我们将要请求五个不同的url: 单线程 import time import urllib2 defget_responses(): urls=[ ‘http...

TensorFlow用expand_dim()来增加维度的方法

TensorFlow中,想要维度增加一维,可以使用tf.expand_dims(input, dim, name=None)函数。当然,我们常用tf.reshape(input, sha...

python生成excel的实例代码

本文实例为大家分享了python生成excel的具体代码,供大家参考,具体内容如下 #_*_coding:utf-8_*_ import MySQLdb import xlwt f...

Python读取图片属性信息的实现方法

Python读取图片属性信息的实现方法

本文是利用Python脚本读取图片信息,有几个说明如下:      1、没有实现错误处理      2、没...

Python2比较当前图片跟图库哪个图片相似的方法示例

本文实例讲述了Python2比较当前图片跟图库哪个图片相似的方法。分享给大家供大家参考,具体如下: # -*- coding: utf-8 -*- ''' Created on 20...