大学物理实验——热敏电阻数据处理Python代码

编程入门 行业动态 更新时间:2024-10-16 00:20:16

大学物理实验——<a href=https://www.elefans.com/category/jswz/34/1740524.html style=热敏电阻数据处理Python代码"/>

大学物理实验——热敏电阻数据处理Python代码

大学物理实验——热敏电阻数据处理Python代码

还是一样,使用jupyter运行代码

先手准备

import matplotlib.pyplot as plt
import numpy as np
import matplotlib
%matplotlib inline#数据处理及前期准备
tem = [21.2,25.8,30,35,40,45,47,50,55,60]
tem = np.array(tem)
u = np.array([0.1,32.2,63.4,101.9,141.5,180.7,196.6,219.8,256.5,303.1])#求1/T * 10**(-3)
Td = np.round(1/(tem+273.5)*(10**3),3)
print(Td)
#求lnRt
Rt = np.array([3510,2909,2486,2076,1726,1463,1350,1241,1069.2,859.1])
lnRt = np.round(np.log(Rt),3)
print(lnRt)

热敏电阻温度特性关系曲线

# let's draw a picture
plt.rcParams['font.sans-serif'] = ['SimHei']  # 用来正常显示中文标签
plt.rcParams['axes.unicode_minus'] = False  # 用来正常显示负号y = 3.74*Td-4.45                                #自己算出来的近似直线plt.figure()plt.plot(Td,lnRt,'-or',linewidth='2.2')
plt.plot(Td,y,":k",linewidth='2.4')plt.xlabel('$1/T\ (*10)^{-3}\ K^{-1}$',size='13')
plt.ylabel('$lnRt$',size='14')
plt.grid(True)#网格线
plt.title('图1:lnRt-1/T关系曲线',size='15')
#R = 0.9936
plt.text(3.14,8.15,r"$y = 3.75*Td-4.450$",fontdict={'size':14})
plt.text(3.16,8.,r"$R\ =\ 0.987$",fontdict={'size':14})plt.xlim((2.95,3.45))
plt.savefig('./图1:热敏电阻温度特性关系曲线.jpg',dpi=400) #保存图片,清晰度400

效果图如下:

设计数字温度计

# let's draw a picture
plt.rcParams['font.sans-serif'] = ['SimHei']  # 用来正常显示中文标签
plt.rcParams['axes.unicode_minus'] = False  # 用来正常显示负号# x = np.arange(10)
y = 7.789*tem-164.352                              #自己算出来的近似直线plt.figure()plt.plot(tem,u,'-or',linewidth='2.2')
plt.plot(tem,y,':k',linewidth='3')plt.xlabel(r'$t\ /\ ^oC$',size='13')
plt.ylabel(r'$U_0\ /\ mV$',size='14')
plt.grid(True)#网格线
plt.title('图2:Uo-t关系曲线',size='15')
#R=0.999
plt.text(25,280,r"$y = 7.789*t-164.352$",fontdict={'size':12})
plt.text(25,250,r"$R\ =\ 0.999$",fontdict={'size':12})plt.ylim((0,350))
plt.xlim((0,65))
plt.savefig('./图2:设计数字温度计.jpg',dpi=400) #保存图片,清晰度400

效果图如下:

更多推荐

大学物理实验——热敏电阻数据处理Python代码

本文发布于:2024-03-23 16:49:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1740522.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:热敏电阻   数据处理   物理实验   代码   大学

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!