diff --git a/6.py b/6.py index e345b3d..cff9a12 100644 --- a/6.py +++ b/6.py @@ -1,29 +1,50 @@ import numpy as np import matplotlib.pyplot as plt +colors = ["blue", "orange"] + gewicht = [50, 100, 150, 200, 250, 300, 350] V = np.divide(5, 0.002) +U_1_4 = [0.113, 0.214, 0.316, 0.428, 0.524, 0.640, 0.727] +U_voll = [0.415, 0.893, 1.267, 1.707, 2.140, 2.590, 2.993] +E = 70000 +b = 0.05 +h = 1 +l = 0.1 +g = 9.81 +k = 2.05 -def viertelmessbrücke_gemessen(): - U_filtered = [0.113, 0.214, 0.316, 0.428, 0.524, 0.640, 0.727] - m = np.divide(U_filtered, gewicht) +def plot_weight(): + m = gewicht + m_1_4 = np.divide(E*b*np.square(h) * 4 * np.multiply(0.002, U_1_4), 6*l*g*k*5) + m_voll = np.divide(E*b*np.square(h) * np.multiply(0.002, U_voll), 6*l*g*k*5) print(m) - print(gewicht) - # plt.plot(m, label='Gewicht') - # plt.plot(gewicht, label='Gewicht angegeben') - # plt.legend() - # plt.grid() - # plt.xlabel('time in ms') - # plt.ylabel('value') - # plt.show() + plt.plot(gewicht, m, label='Theoretisches Gewischt') + plt.plot(gewicht, m_1_4*1000, label=r'Gewicht bei $\frac{1}{4}$messbrücke', linestyle='--', marker='x', markersize=8) + plt.plot(gewicht, m_voll*1000, label='Gewicht bei Vollmessbrücke', linestyle='--', marker='x', markersize=8) + plt.legend() + plt.grid() + plt.xlabel('Gewicht [g]') + plt.ylabel('Gewicht [g]') + plt.show() + plt.savefig("prak6/weight.svg", format="svg", bbox_inches="tight") + plt.close() - -# def viertelmessbrücke_theorie(): -# m = #np.divide(Ebh², 6lgk) - -def vollmessbrücke(): - U_filtered = [0.415, 0.893, 1.267, 1.707, 2.140, 2.590, 2.993] +def plot_voltage(): + u_t_1_4 = np.divide(6 * l*g*k*np.multiply(5, gewicht), E*b* np.multiply(0.002, np.square(h)) * 4) + u_t_voll = np.divide(6 * l*g*k*np.multiply(5, gewicht), E*b* np.multiply(0.002, np.square(h))) + plt.plot(gewicht, np.divide(u_t_voll, 1000), label='Theoretische Spannung der Vollmessbrücke', color=colors[1]) + plt.plot(gewicht, U_voll, label='Gemessene Spannung der Vollmessbrücke', linestyle='--', marker='x', markersize=8, color=colors[1]) + plt.plot(gewicht, np.divide(u_t_1_4, 1000), label='Theoretische Spannung der Viertelmessbrücke', color=colors[0]) + plt.plot(gewicht, U_1_4, label='Gemessene Spannung der Viertelmessbrücke', linestyle='--', marker='x', markersize=8, color=colors[0]) + plt.legend() + plt.grid() + plt.xlabel('Gewicht [g]') + plt.ylabel('Spannung [V]') + plt.show() + plt.savefig("prak6/voltage.svg", format="svg", bbox_inches="tight") + plt.close() if __name__ == '__main__': - viertelmessbrücke_gemessen() - #vollmessbrücke() \ No newline at end of file + plot_weight() + plot_voltage() \ No newline at end of file diff --git a/prak6/voltage.svg b/prak6/voltage.svg new file mode 100644 index 0000000..2b3880d --- /dev/null +++ b/prak6/voltage.svg @@ -0,0 +1,32 @@ + + + + + + + + 2026-02-02T17:48:15.326619 + image/svg+xml + + + Matplotlib v3.10.8, https://matplotlib.org/ + + + + + + + + + + + + + + diff --git a/prak6/weight.svg b/prak6/weight.svg new file mode 100644 index 0000000..25fb29b --- /dev/null +++ b/prak6/weight.svg @@ -0,0 +1,32 @@ + + + + + + + + 2026-02-02T17:48:14.044892 + image/svg+xml + + + Matplotlib v3.10.8, https://matplotlib.org/ + + + + + + + + + + + + + +