Files
2026-10-02 11:10:29 +02:00

97 KiB
Executable File

Induction

In [8]:
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
from math import pi, sqrt, log, exp
In [30]:
I = 3.003
N1 = 1160
dN1 = 2
N2 = 1000
dN2 = 2
l1 = 0.2735
dl1 = 0.5 * 1e-3
l2 = 0.004
dl2 = 0.2 * 1e-3
r1 = 0.0254
dr1 = 0.2 * 1e-3
r2 = 0.01975
dr2 = 0.15 * 1e-3
mu0 = 4*pi*1e-7
omega = 2 * pi *1e3

Induced magnetic field in solenoid

In [10]:
data1 = pd.DataFrame({
    "z": [-135, -120, -105, -80, -60, -30, -15, 0, 15, 30, 60, 80, 105, 120, 135],
    "dz": [2.5]*15,
    "U": [55, 89, 103, 111, 114, 115, 115, 115, 115, 114, 114, 112, 105, 93, 61],
    "dU": [1.0]*15
})

plt.errorbar(data1["z"], data1["U"], xerr=data1["dz"], yerr=data1["dU"], fmt="o")
plt.xlabel(r"$z$ (mm)")
plt.ylabel(r"$U_{\text{ind}}$ (mV)")
plt.title("Induced Voltage vs. Position")
plt.show()
In [11]:
B = lambda U: U/(N2*omega*pi*r2**2)
dB = lambda U, dU: np.sqrt(
    (dU / (N2 * omega * pi * r2**2))**2
    + (U * dN2 / (N2**2 * omega * pi * r2**2))**2
    + (U * dl2 / (N2 * omega * pi * r2**2 * l2))**2
    + (2 * U * dr2 / (N2 * omega * pi * r2**3))**2
)

print(f"B(0) = {B(data1.loc[7, 'U']):.2e} ± {dB(data1.loc[7, 'U'], data1.loc[7, 'dU']):.2e} T")
B(0) = 9.38e-08 ± 4.98e-09 T

Measure of magnetic permeability

In [ ]:
data2 = pd.DataFrame({
    "I": [6.08, 5.70, 5.36, 5.06, 4.79, 4.55, 4.33, 4.13, 3.74, 3.591, 3.453, 3.3325, 3.205, 3.095, 2.992],
    "dI": [0.001]*15,
    "U": [235, 220, 206, 195, 184, 175, 166, 159, 144, 138, 132, 128, 123, 119, 115],
    "dU": [1]*15
})

slope, intercept, r_value, p_value, std_err = stats.linregress(data2["I"], data2["U"])
print(f"Slope: {slope:.2e} ± {std_err:.2e} mV/A")

plt.errorbar(data2["I"], data2["U"], xerr=data2["dI"], yerr=data2["dU"], fmt="o")
plt.plot(data2["I"], slope*data2["I"] + intercept, label=f"Fit: U = {slope:.2e} I + {intercept:.2e}")
plt.xlabel(r"Current $I$ (mA)")
plt.ylabel(r"Induced Voltage $U_{\text{ind}}$ (mV)")
plt.title("Induced Voltage vs. Current")
plt.text(0.5, 0.9, f"{slope:.2e} ± {std_err:.2e} mV/mA", transform=plt.gca().transAxes)
plt.show()
Slope: 3.88e+01 ± 1.01e-01 mV/A
In [31]:
mu0 = (slope) / (pi * r2 ** 2 * N1 * N2 * omega) * sqrt(4 * r1 ** 2 + l1 ** 2)
dmu0 = mu0 * sqrt(
    (std_err / slope)**2
    + (2 * dr2 / r2)**2
    + (dN1 / N1)**2
    + (dN2 / N2)**2
    + (4 * r1 * dr1 / (4 * r1**2 + l1**2))**2
    + (l1 * dl1 / (4 * r1**2 + l1**2))**2
)
print(f"mu0 = {mu0:.3e} ± {dmu0:.3e}")
mu0 = 1.208e-06 ± 1.901e-08

Solenoid inductance

In [39]:
R2 = 27.4
dR2 = 0.1

L = lambda R1, R2, f: (sqrt(R1**2 - R2**2)) / (2 * pi * f)
dL = lambda R1, dR1, R2, dR2, f, df: np.sqrt(
    ((R1 * dR1) / (2 * pi * f * sqrt(R1**2 - R2**2)))**2
    + ((R2 * dR2) / (2 * pi * f * sqrt(R1**2 - R2**2)))**2
    + ((sqrt(R1**2 - R2**2) * df) / (2 * pi * f**2))**2
)

data3 = pd.DataFrame({
    "f": [400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1050, 1100],
    "df": [1]*15,
    "R1": [42.4,45.5, 48.8, 52.2, 55.71, 59.3, 62.9, 66.6, 70.32, 74.1, 77.9, 81.73, 85.6, 89.5, 93.4],
    "dR1": [0.01]*15,
})

data3["L"] = [L(R1, R2, f) * 1e3 for R1, f in zip(data3["R1"], data3["f"])]
data3["dL"] = [dL(R1, dR1, R2, dR2, f, df) * 1e3 for R1, dR1, f, df in zip(data3["R1"], data3["dR1"], data3["f"], data3["df"])]

data3
Out [39]:
f df R1 dR1 L dL
0 400 1 42.40 0.01 12.874592 0.046887
1 450 1 45.50 0.01 12.847265 0.039325
2 500 1 48.80 0.01 12.853888 0.033796
3 550 1 52.20 0.01 12.857005 0.029605
4 600 1 55.71 0.01 12.866649 0.026337
5 650 1 59.30 0.01 12.876910 0.023724
6 700 1 62.90 0.01 12.873011 0.021579
7 750 1 66.60 0.01 12.881482 0.019803
8 800 1 70.32 0.01 12.884030 0.018300
9 850 1 74.10 0.01 12.891180 0.017018
10 900 1 77.90 0.01 12.895480 0.015907
11 950 1 81.73 0.01 12.899963 0.014936
12 1000 1 85.60 0.01 12.906867 0.014083
13 1050 1 89.50 0.01 12.914687 0.013326
14 1100 1 93.40 0.01 12.919118 0.012647
In [40]:
L_mean = data3["L"].mean()
L_std = data3["L"].std()
print(f"Mean L: {L_mean:.2e} +- {L_std:.2e}")
Mean L: 1.29e+01 +- 2.18e-02

Self capacity of the Solenoid

In [44]:
C= lambda L, omega: 1 / (omega**2 * L)
dC = lambda L, dL, omega: (dL / L) * C(L, omega)

data4 = pd.DataFrame({
  "f": [1e3, 5e3, 1e4, 1.5e4, 1.6e4, 1.7e4, 1.75e4, 1.775e4, 1.7875e4, 1.8e4, 1.825e4, 1.85e4, 1.9e4, 2e4, 2.5e4],
  "df": [0.0001]*15,
  "U": [20, 25, 37, 90, 134, 260, 440, 560, 600, 590, 475, 360, 220, 120, 37],
  "dU": [10]*15,
})

plt.errorbar(data4["f"], data4["U"], xerr=data4["df"], yerr=data4["dU"], fmt="o")
plt.xlabel(r"Frequency $f$ (Hz)")
plt.ylabel(r"Voltage $U$ (mV)")
plt.title("Voltage vs. Frequency")
plt.show()
In [45]:
omega_res = 17.875e3 * 2 * pi
print(f"Resonance frequency: {omega_res:.2e} rad/s")
Resonance frequency: 1.12e+05 rad/s
In [46]:
print(f"C at resonance: {C(L_mean, omega_res):.2e} F ± {dC(L_mean, L_std, omega_res):.2e} F")
C at resonance: 6.15e-12 F ± 1.04e-14 F
In [ ]: