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 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) 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 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__': plot_weight() plot_voltage()