I just evaluated random code in my console
This commit is contained in:
parent
e9a1d3ef2c
commit
3ffda80c4a
@ -14,7 +14,7 @@ k_L = 2e-10
|
||||
def calculate_d33(voltage_list, weight):
|
||||
charge_list = [(voltage) * k_L for voltage in voltage_list]
|
||||
charge_list = [charge * 0.5 for charge in charge_list]
|
||||
pC_charges=[charge * 1e11 for charge in charge_list]
|
||||
pC_charges=[charge * 1e12 for charge in charge_list]
|
||||
return (sum(pC_charges) / len(pC_charges)) / (weight * 9.81)
|
||||
|
||||
# calculate d33 per weight list (mittelwert)
|
||||
|
||||
@ -19,8 +19,8 @@ ed_real = np.array(data["ED-Real"])
|
||||
fig, (ax1, ax2) = plt.subplots(2, 1, sharex=True, figsize=(8, 6))
|
||||
|
||||
# U..kV und U..kV (3kV/mm) auf dem ersten Subplot darstellen
|
||||
ax1.plot(x, u1, label="U..kV", marker='o', linestyle='-') # Linien hinzugefügt
|
||||
ax1.plot(x, u2, label="U..kV (3kV/mm)", marker='x', linestyle='--') # Unterschiedliche Linienart
|
||||
ax1.plot(x, u1, label="Messwerte", marker='o', linestyle='-', color='blue') # Linien hinzugefügt
|
||||
ax1.plot(x, u2, label="Erwartung (3kV/mm)", marker='x', linestyle='--', color='green') # Unterschiedliche Linienart
|
||||
|
||||
# Fläche zwischen den beiden Linien füllen
|
||||
ax1.fill_between(x, u1, u2, color='red', alpha=0.3, label="Abweichung")
|
||||
@ -31,7 +31,7 @@ ax1.legend()
|
||||
ax1.grid(True)
|
||||
|
||||
# ED-Real auf dem zweiten Subplot darstellen
|
||||
ax2.plot(x, ed_real, label="ED-Real", marker='o', color='green', linestyle='-')
|
||||
ax2.plot(x, ed_real, label="ED-Real", marker='o', linestyle='-', color='blue')
|
||||
|
||||
# Beschriftungen für den zweiten Subplot setzen
|
||||
ax2.set_xlabel("Länge l [mm]")
|
||||
|
||||
@ -8,27 +8,21 @@ messwerte = np.array([65.01, 40.41, 26.67, 19.65, 15.61, 13.13, 11.11, 10.08, 8.
|
||||
konstante = messwerte[0] * abstand[0]
|
||||
idealwerte = konstante / abstand
|
||||
|
||||
# Spline-Interpolation für Messwerte
|
||||
xnew = np.linspace(abstand.min(), abstand.max(), 300)
|
||||
spl = make_interp_spline(abstand, messwerte, k=3)
|
||||
messwerte_smooth = spl(xnew)
|
||||
plt.figure(figsize=(10, 6))
|
||||
|
||||
# Spline-Interpolation für Idealwerte
|
||||
xnew = np.linspace(abstand.min(), abstand.max(), 300)
|
||||
spl_ideal = make_interp_spline(abstand, idealwerte, k=3)
|
||||
idealwerte_smooth = spl_ideal(xnew)
|
||||
|
||||
plt.figure(figsize=(10, 6))
|
||||
# Darstellung der Messwerte und Idealwerte
|
||||
plt.plot(abstand, messwerte, marker='o', linestyle='-', label='Messwerte', color='blue') # Keine Verbindungslinien für Messwerte
|
||||
plt.plot(xnew, idealwerte_smooth, label='Idealwerte', marker='x', linestyle='--', color='green')
|
||||
|
||||
# Fläche zwischen den Graphen füllen
|
||||
plt.fill_between(xnew, messwerte_smooth, idealwerte_smooth, color='red', alpha=0.3, label='Differenz') # alpha für Transparenz
|
||||
|
||||
plt.plot(xnew, messwerte_smooth, linestyle='-', label='Messwerte (geglättet)')
|
||||
plt.plot(xnew, idealwerte_smooth, linestyle='--', label='Idealwerte (geglättet)')
|
||||
plt.xlabel('Abstand l [mm]')
|
||||
plt.ylabel('Kapazität C [pF]')
|
||||
#plt.title('Kapazität in Korrelation zum Abstand eines Luftkondensators (geglättet)')
|
||||
plt.grid(True)
|
||||
plt.legend()
|
||||
plt.xticks(abstand)
|
||||
plt.yticks(np.arange(min(messwerte), max(messwerte)+5, 5.0))
|
||||
plt.yticks(np.arange(min(messwerte), max(messwerte) + 5, 5.0))
|
||||
plt.show()
|
||||
Loading…
Reference in New Issue
Block a user