first commit
This commit is contained in:
commit
7532722c8f
22
1,5mA.csv
Normal file
22
1,5mA.csv
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
24.98,27.17
|
||||||
|
22.2,26.39
|
||||||
|
19.3,25.41
|
||||||
|
16.15,24.39
|
||||||
|
13.22,23.29
|
||||||
|
10.24,21.32
|
||||||
|
7.97,18.88
|
||||||
|
6.22,15.96
|
||||||
|
4.39,12.55
|
||||||
|
2.14,6.32
|
||||||
|
0.69,2.6
|
||||||
|
-25.1,-29.19
|
||||||
|
-22.12,-28.19
|
||||||
|
-19.07,-27.2
|
||||||
|
-16.13,-26.18
|
||||||
|
-13.12,-24.34
|
||||||
|
-10.42,-22.97
|
||||||
|
-8.17,-20.06
|
||||||
|
-6.08,-16.45
|
||||||
|
-4.37,-11.93
|
||||||
|
-2.02,-6.33
|
||||||
|
-0.5,-1.65
|
|
22
3mA.csv
Normal file
22
3mA.csv
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
24.98,56.46
|
||||||
|
21.78,54.35
|
||||||
|
19.03,53.45
|
||||||
|
16.18,58.73
|
||||||
|
13.49,26
|
||||||
|
10.41,45.8
|
||||||
|
7.77,39.75
|
||||||
|
5.96,33.4
|
||||||
|
4.39,26.79
|
||||||
|
1.92,14.53
|
||||||
|
0.55,6.48
|
||||||
|
-25.1,-60.56
|
||||||
|
-21.87,-58.7
|
||||||
|
-19.14,-57.05
|
||||||
|
-16.4,-55.78
|
||||||
|
-13.2,-52.7
|
||||||
|
-10.12,-47.06
|
||||||
|
-8.1,-42.24
|
||||||
|
-6.16,-35.07
|
||||||
|
-4.26,-26.24
|
||||||
|
-2.11,-14.42
|
||||||
|
-0.5,-5.19
|
|
22
5mA.csv
Normal file
22
5mA.csv
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
24.98,105.85
|
||||||
|
21.94,103.84
|
||||||
|
19.09,101.27
|
||||||
|
16,97.68
|
||||||
|
13.1,91.76
|
||||||
|
9.74,80.93
|
||||||
|
8.1,73.68
|
||||||
|
6.12,62.93
|
||||||
|
4.1,49.76
|
||||||
|
2.1,32.23
|
||||||
|
0.5,18.01
|
||||||
|
-25,-113.54
|
||||||
|
-22.05,-110.88
|
||||||
|
-19.31,-108.29
|
||||||
|
-16.39,-103.44
|
||||||
|
-12.91,-96.33
|
||||||
|
-10.23,-87.22
|
||||||
|
-7.88,-75.27
|
||||||
|
-6,-64.18
|
||||||
|
-4.1,-49.99
|
||||||
|
-1.9,-30.78
|
||||||
|
-0.5,-18.87
|
|
116
Analize.py
Normal file
116
Analize.py
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
from contextlib import redirect_stderr
|
||||||
|
import numpy as np
|
||||||
|
from matplotlib import pyplot as plt
|
||||||
|
import csv
|
||||||
|
import scipy.constants as sp
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
print("Code is running.")
|
||||||
|
plot_UI(open_CSV("U(I).csv"))
|
||||||
|
plot_UIs(open_CSV("1,5mA.csv"), '[1,5mA]')
|
||||||
|
plot_UIs(open_CSV("3mA.csv"), '[3mA]')
|
||||||
|
plot_UIs(open_CSV("5mA.csv"), '[5mA]')
|
||||||
|
|
||||||
|
|
||||||
|
def open_CSV(filename):
|
||||||
|
with open('/home/dmitrii/Physics Labs/3.5.1/' + filename, newline="") as csvfile:
|
||||||
|
datareader = csv.reader(csvfile, delimiter=",", quotechar="|")
|
||||||
|
data = []
|
||||||
|
for row in datareader:
|
||||||
|
res = [float(i) for i in row]
|
||||||
|
data.append(res)
|
||||||
|
data = np.array(data)
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
def plot_UI(data):
|
||||||
|
plt.scatter(data[:, 1][0:23], data[:, 0][0:23], color="g")
|
||||||
|
plt.scatter(data[:, 1][23:len(data)], data[:, 0]
|
||||||
|
[23:len(data)], color="orange")
|
||||||
|
plt.xticks(np.arange(min(data[:, 1])-0.25, max(data[:, 1])+0.25, 0.25))
|
||||||
|
plt.yticks(np.arange(min(data[:, 0])-1, max(data[:, 0])+1, 1))
|
||||||
|
A = np.vstack([data[:, 1][5:12], np.ones(len(data[:, 1][5:12]))]).T
|
||||||
|
alpha = np.dot((np.dot(np.linalg.inv(np.dot(A.T, A)), A.T)),
|
||||||
|
data[:, 0][5:12])
|
||||||
|
var = str(round(alpha[1]*10**3))
|
||||||
|
delta = str(abs(round(alpha[0]*10**3)))
|
||||||
|
print("Максимальное дифференциальное сопротивление разряда: {}".format(
|
||||||
|
var) + u" \u00B1 " + "{}, Ом".format(delta))
|
||||||
|
plt.plot(data[:, 1][5:12], alpha[0]*data[:, 1][5:12]+alpha[1], 'r')
|
||||||
|
plt.ylabel('U, В', fontsize=20)
|
||||||
|
plt.xlabel('I, мкА', fontsize=20)
|
||||||
|
plt.grid()
|
||||||
|
plt.savefig('U(I).png')
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
|
def centre(data):
|
||||||
|
xdiff = [data[n]-data[n-1] for n in range(1, len(data))]
|
||||||
|
return sum(xdiff)/2
|
||||||
|
|
||||||
|
|
||||||
|
def bfl(data):
|
||||||
|
line = np.polyfit(data[:, 0], data[:, 1], 1)
|
||||||
|
return line
|
||||||
|
|
||||||
|
|
||||||
|
def plot_UIs(data, num):
|
||||||
|
ax = plt.gca()
|
||||||
|
ax.spines['top'].set_color('none')
|
||||||
|
ax.spines['left'].set_position('zero')
|
||||||
|
ax.spines['right'].set_color('none')
|
||||||
|
ax.spines['bottom'].set_position('zero')
|
||||||
|
plt.scatter(data[:, 0], data[:, 1], color="g",
|
||||||
|
marker="+", s=100) # Make a scatter plot
|
||||||
|
data = np.array(sorted(data, key=lambda x: x[0], reverse=True))
|
||||||
|
line1 = bfl(data[len(data)-5:len(data)])
|
||||||
|
line2 = bfl(data[0:5])
|
||||||
|
aprox = bfl(data[4:len(data)-5])
|
||||||
|
x1 = (line1[1]-aprox[1])/(aprox[0]-line1[0])
|
||||||
|
y1 = line1[0]*x1+line1[1]
|
||||||
|
plt.plot(x1, y1, marker='+', color='red')
|
||||||
|
x2 = (line2[1]-aprox[1])/(aprox[0]-line2[0])
|
||||||
|
y2 = line2[0]*x2+line2[1]
|
||||||
|
plt.plot(x2, y2, marker='+', color='red')
|
||||||
|
plt.plot((data[:, 0][len(data)-5:len(data)]), (data[:, 0]
|
||||||
|
[len(data)-5:len(data)]*line1[0]+line1[1]), color="orange")
|
||||||
|
plt.plot([x1, 0], [y1, line1[1]], linestyle="dashed", color="orange",
|
||||||
|
label='Ток насыщения: ' + str(round(line1[1], 2)) + ' ,А')
|
||||||
|
plt.plot(data[:, 0][0:5], data[:, 0]
|
||||||
|
[0:5]*line2[0]+line2[1], color="orange")
|
||||||
|
plt.plot([x2, 0], [y2, line2[1]], linestyle="dashed", color="orange",
|
||||||
|
label='Ток насыщения: ' + str(round(line2[1], 3)) + ' ,А')
|
||||||
|
S = sp.pi*0.2*10**-4*5.2*10**-4
|
||||||
|
me = 22*1.66*10**-27
|
||||||
|
Te = x2/2*11400
|
||||||
|
ni = line2[1]/0.4/sp.e/S/np.sqrt(2*sp.k*Te/me)/10**14
|
||||||
|
wp = np.sqrt(4*np.pi*ni*sp.e**2/me)*10**10
|
||||||
|
rde = np.sqrt(sp.k*Te/4/sp.pi/ni/sp.e**2)*10**-5
|
||||||
|
rd = np.sqrt(sp.k*300/4/sp.pi/ni/sp.e**2)
|
||||||
|
Nd = 4/3*sp.pi*rd**3*ni
|
||||||
|
print("-----Exp{}-----".format(num))
|
||||||
|
print("Ток насыщения: {},{}".format(
|
||||||
|
round(line1[1], 3), round(line2[1], 3)))
|
||||||
|
print("Te = {}".format(Te ))
|
||||||
|
print("Ni = {}".format(ni))
|
||||||
|
print("wp = {}".format(wp))
|
||||||
|
print("rde = {}".format(rde))
|
||||||
|
print("rd = {}".format(rd))
|
||||||
|
print("Nd = {}".format(Nd))
|
||||||
|
print("---------------")
|
||||||
|
plt.xlabel('U, В', fontsize=20)
|
||||||
|
plt.ylabel('I, мкА', fontsize=20)
|
||||||
|
plt.grid()
|
||||||
|
ax.legend()
|
||||||
|
plt.savefig(num + '.png')
|
||||||
|
plt.show()
|
||||||
|
return plt
|
||||||
|
|
||||||
|
|
||||||
|
def plotAll(plot1, plot2, plot3):
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
43
U(I).csv
Normal file
43
U(I).csv
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
34.85,0.5
|
||||||
|
34.3,0.8
|
||||||
|
33.76,1
|
||||||
|
33.33,1.16
|
||||||
|
32.96,1.4
|
||||||
|
32.39,1.6
|
||||||
|
30.24,1.8
|
||||||
|
29.02,2
|
||||||
|
28.19,2.2
|
||||||
|
27.59,2.4
|
||||||
|
26.69,2.6
|
||||||
|
26.25,2.8
|
||||||
|
27.08,3
|
||||||
|
27.06,3.2
|
||||||
|
26.51,3.4
|
||||||
|
25.82,3.6
|
||||||
|
25.33,3.8
|
||||||
|
24.91,4.04
|
||||||
|
24.68,4.24
|
||||||
|
24.48,4.4
|
||||||
|
24.29,4.64
|
||||||
|
24.21,4.76
|
||||||
|
24.37,4.56
|
||||||
|
24.61,4.32
|
||||||
|
24.75,4.2
|
||||||
|
24.99,4.04
|
||||||
|
25.45,3.8
|
||||||
|
26.07,3.56
|
||||||
|
26.57,3.4
|
||||||
|
27.09,2.34
|
||||||
|
27.26,3
|
||||||
|
26.43,2.8
|
||||||
|
26.44,2.6
|
||||||
|
27.49,2.4
|
||||||
|
28.31,2.2
|
||||||
|
29.04,1.96
|
||||||
|
30.33,1.8
|
||||||
|
32.62,1.56
|
||||||
|
32.88,1.4
|
||||||
|
33.32,1.2
|
||||||
|
33.74,1.04
|
||||||
|
34.22,0.8
|
||||||
|
34.59,0.6
|
|
BIN
[1,5mA].png
Normal file
BIN
[1,5mA].png
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
Loading…
Reference in New Issue
Block a user