In [1]:
import numpy as np
from matplotlib import pyplot as plt
import labwork
from labwork import *
In [2]:
help(labwork)
In [27]:
U1 = 3 # V
E1 = np.array([
[6.4 * 0.010 / 2, 5000],
[6.4 * 0.020 / 2, 10000],
[4.0 * 0.050 / 2, 15000],
[5.3 * 0.050 / 2, 20000],
[6.9 * 0.050 / 2, 25000]
])
In [28]:
E1
Out[28]:
In [65]:
a, b, sigma_a, sigma_b = linPlot(E1[:, 0], E1[:, 1], xlabel=r"$\varepsilon_{02} [В]$",
ylabel="f [Гц]",title="$U_4 = 3В$", labplot=True)
print(sigma_a / a, sigma_b/b)
a, b, sigma_a, sigma_b
f = E1[:, 1]
U = U1
Eps = E1[:, 0]
R = 1e4
R_R = 5 * 1e-2
U_R = 1 / 30 / 2
f_R = 0.01
Eps_R = np.array([0.010 / 8,0.020 / 8,0.050 / 8,0.050 / 8,0.050 / 8,]) / Eps
print(Eps_R)
m21_R = [prodErrorR([f_R, U_R, R_R, Eps_R[i]]) for i in range(5)]
m21 = (Eps * R)/(2 * np.pi * f * U)
for i in range(5):
print("m21 = " + sciRoundR(m21[i], m21_R[i]))
print(Eps, U, m21)
In [66]:
a, b, sigma_a, sigma_b = linPlot(1./E1[:, 1], m21, ylabel=r"$M_{21} [Гн]$",
xlabel="$f^{-1} [1/Гц]$ ",title="$U_4 = 3В$", labplot=True)
print(sigma_a / a, sigma_b/b)
a, b, sigma_a, sigma_b
print(sciRoundR(a + 1 / 15000 * b, sigma_a/a))
In [ ]:
U2 = 2 # V
E2 = np.array([
[4.2 * 0.010 / 2, 5000],
[4.2 * 0.020 / 2, 10000],
[6.4 * 0.020 / 2, 15000],
[3.4 * 0.050 / 2, 20000],
[4.5 * 0.050 / 2, 25000]
])
linPlot(E2[:, 0], E2[:, 1], xlabel=r"$\varepsilon_{02} [В]$",
ylabel="f [Гц]",title="$U_4 = 2В$", labplot=True)
In [63]:
U3 = 5 # V
E3 = np.array([
[5.2 * 0.020 / 2, 5000],
[4.2 * 0.050 / 2, 10000],
[6.4 * 0.050 / 2, 15000],
[4.2 * 0.100 / 2, 20000],
[5.6 * 0.100 / 2, 25000]
])
linPlot(E3[:, 0], E3[:, 1], xlabel=r"$\varepsilon_{02} [В]$",
ylabel="f [Гц]",title="$U_4 = 5В$", labplot=True)
Out[63]:
In [64]:
f = np.array([E1[1, 1], E2[1, 1], E2[1, 1]])
print(f)
f = f.mean()
U = np.array([U1, U2, U3])
Eps = np.array([E1[1, 0], E2[1, 0], E3[1, 0]])
R = 1e4
R_R = 5*1e-2
U_R = 1 / 30 / 2
f_R = 0.01
Eps_R = np.array([0.020 / 8,0.020 / 8,0.020 / 8,]) / Eps
print(Eps_R)
m21_R = [prodErrorR([f_R, U_R, R_R, Eps_R[i]]) for i in range(3)]
m21 = (Eps * R)/(2 * np.pi * f * U)
for i in range(3):
print("m21 = " + sciRoundR(m21[i], m21_R[i]))
print(Eps, U, m21)
In [70]:
A = np.array([
[20, 7 * 0.02, 5.6 * 0.50],
[19, 5.7 * 0.02, 5.5 * 0.50], # Vpp, W, H
[18, 4.8 * 0.02, 5.4 * 0.50], # 5.4 - 5.3
[17, 7.8 * 0.01, 5.05 * 0.50],
[16, 6.6 * 0.01, 4.8 * 0.50],
[15, 6.0 * 0.01, 4.6 * 0.5],
[14, 5.4 * 0.01, 4.2 * 0.5],
[13, 5.0 * 0.01, 3.9 *0.5],
[12, 9.2 * 0.005, 3.6 *0.5],
[11, 8.0 * 0.005, 3.4 * 0.5],
[10, 7.2 * 0.005, 7.6 * 0.2],
[ 9, 6.5 * 0.005, 6.8 * 0.2],
[ 8, 6.0 * 0.005, 6.1 * 0.2],
[ 7, 5.3 * 0.005, 5.3 * 0.2],
[ 6, 4.9 * 0.005, 4.6 * 0.2],
[ 5, 4.0 * 0.005, 3.9 * 0.2],
[ 4, 3.4 * 0.005, 6.1 * 0.1],
[ 3, 2.7 * 0.005, 4.6 * 0.1],
[ 2, 2.0 * 0.005, 3.1 * 0.1],
[ 1, 1.3 * 0.005, 3.1 * 0.05]
])
In [87]:
import pandas as pd
df = pd.DataFrame()
df["Vpp"] = A[:, 0]
df["A_W [V]"] = A[:, 1]
df["A_H [V]"] = A[:, 2]
df
Out[87]:
In [71]:
plt.figure()
plt.plot(A[:, 0], A[:, 1])
# plt.plot(A[:, 0], A[:, 2])
plt.show()
In [72]:
plt.figure()
plt.plot(A[:, 0], A[:, 2])
plt.show()
In [73]:
d1 = 18 * 1e-3
d2 = 9 * 1e-3
r_avg = (d1 + d2) / 4
N1 = 100
R1 = 51
H = A[:, 1] * N1 / (R1 * 2 * np.pi * r_avg)
In [74]:
H # мю в 100 раз больше
Out[74]:
In [75]:
C = 0.22 * 1e-6
N2 = 200
h = 5 * 1e-3
R2 = 4.3 * 1e3
S = h * (d1 - d2) / 2
B = A[:, 2] * C * R2 / (S * N2)
In [76]:
B
Out[76]:
In [ ]:
In [77]:
mu0 = 4*np.pi * 1e-7
In [78]:
J = B / mu0 - H
mu = B / H / mu0
In [82]:
plt_lab_figure(H.max(), B.max(), X_min=H.min(), Y_min=B.min())
plt.plot(H, B, "-o")
plt.xlabel("H", fontsize=20)
plt.ylabel("B", fontsize=20)
plt.show()
plt_lab_figure(H.max(), J.max(), X_min=H.min(), Y_min=J.min())
plt.plot(H, J, "-x")
plt.xlabel("H", fontsize=20)
plt.ylabel("J", fontsize=20)
plt.show()
plt_lab_figure(H.max(), mu.max(), X_min=H.min(), Y_min=mu.min())
plt.plot(H, mu, "-+")
plt.xlabel("H", fontsize=20)
plt.ylabel("mu", fontsize=20)
plt.show()
In [80]:
mu.max()
Out[80]:
In [81]:
mu.mean()
Out[81]:
In [ ]: