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()

32
prak6/voltage.svg Normal file
View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns:xlink="http://www.w3.org/1999/xlink" width="475.2pt" height="360pt" viewBox="0 0 475.2 360" xmlns="http://www.w3.org/2000/svg" version="1.1">
<metadata>
<rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<cc:Work>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<dc:date>2026-02-02T17:48:15.326619</dc:date>
<dc:format>image/svg+xml</dc:format>
<dc:creator>
<cc:Agent>
<dc:title>Matplotlib v3.10.8, https://matplotlib.org/</dc:title>
</cc:Agent>
</dc:creator>
</cc:Work>
</rdf:RDF>
</metadata>
<defs>
<style type="text/css">*{stroke-linejoin: round; stroke-linecap: butt}</style>
</defs>
<g id="figure_1">
<g id="patch_1">
<path d="M 0 360
L 475.2 360
L 475.2 0
L 0 0
z
" style="fill: #ffffff"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

32
prak6/weight.svg Normal file
View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns:xlink="http://www.w3.org/1999/xlink" width="475.2pt" height="360pt" viewBox="0 0 475.2 360" xmlns="http://www.w3.org/2000/svg" version="1.1">
<metadata>
<rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<cc:Work>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<dc:date>2026-02-02T17:48:14.044892</dc:date>
<dc:format>image/svg+xml</dc:format>
<dc:creator>
<cc:Agent>
<dc:title>Matplotlib v3.10.8, https://matplotlib.org/</dc:title>
</cc:Agent>
</dc:creator>
</cc:Work>
</rdf:RDF>
</metadata>
<defs>
<style type="text/css">*{stroke-linejoin: round; stroke-linecap: butt}</style>
</defs>
<g id="figure_1">
<g id="patch_1">
<path d="M 0 360
L 475.2 360
L 475.2 0
L 0 0
z
" style="fill: #ffffff"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB