From 3ffda80c4ae2fbd084350c2a9a83420146c281bf Mon Sep 17 00:00:00 2001 From: Maximilian Eibl Date: Thu, 30 Jan 2025 18:12:58 +0100 Subject: [PATCH] I just evaluated random code in my console --- d33-berechnung.py | 2 +- durschl-luft-graph.py | 6 +++--- kapazität-luft_kondensator-graph.py | 18 ++++++------------ 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/d33-berechnung.py b/d33-berechnung.py index c584907..ec885a0 100644 --- a/d33-berechnung.py +++ b/d33-berechnung.py @@ -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) diff --git a/durschl-luft-graph.py b/durschl-luft-graph.py index f957ffa..2398a7a 100644 --- a/durschl-luft-graph.py +++ b/durschl-luft-graph.py @@ -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]") diff --git a/kapazität-luft_kondensator-graph.py b/kapazität-luft_kondensator-graph.py index 0128b3b..d0fd292 100644 --- a/kapazität-luft_kondensator-graph.py +++ b/kapazität-luft_kondensator-graph.py @@ -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() \ No newline at end of file