Update for Prak6

This commit is contained in:
Hannes
2026-02-02 17:51:59 +01:00
parent 02c2773ee7
commit 2ec5e271c3
3 changed files with 104 additions and 19 deletions

59
6.py
View File

@@ -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()
plot_weight()
plot_voltage()