Ejemplo n.º 1
0
def auswertung_beidseitig(titel, datei, x, D, d, L, m, I):
    x1, x2 = array_split(x, 2)
    D1, D2 = array_split(D, 2)

    u1 = 3 * L**2 * x1 - 4 * x1**3
    u2 = 4 * x2**3 - 12 * L * x2**2 + 9 * L**2 * x2 - L**3

    A1, dA1, B1, dB1 = linregress.linear_fit(u1, D1)
    A2, dA2, B2, dB2 = linregress.linear_fit(u2, D2)

    E1 = (m * g) / (48 * A1 * I)
    E2 = (m * g) / (48 * A2 * I)
    dE1 = (m * g * dA1) / (48 * A1**2 * I)
    dE2 = (m * g * dA2) / (48 * A2**2 * I)

    plt.title(titel)
    plt.subplot(211)
    plt.grid()
    plt.xlabel(r"$(3L^2x - 4x^3)/\mathrm{m}^3$")
    plt.ylabel(r"$D/\mathrm{m}$")
    plt.plot(u1, D1, "+")
    plt.plot(u1, A1 * u1 + B1)
    plt.subplot(212)
    plt.grid()
    plt.xlabel(r"$(4x^3 - 12Lx^2 + 9L^2x - L^3)/\mathrm{m}^3$")
    plt.ylabel(r"$D/\mathrm{m}$")
    plt.plot(u2, D2, "+")
    plt.plot(u2, A2 * u2 + B2)

    plt.savefig(datei)
    plt.clf()

    E = (E1 + E2) / 2

    print(titel + """
  ------------------------------------------------------------------------
  Durchmesser d                     ({0:.5e} ± {1:.5e})  mm
  Elastizitätsmodul E_f             ({2:.5e} ± {3:.5e})  kN/mm^2
  Elastizitätsmodul E_g             ({4:.5e} ± {5:.5e})  kN/mm^2
  Steigung A_f                       {6:.5e} ± {7:.5e}
  Steigung A_g                       {8:.5e} ± {9:.5e}
  Ordinatenabschnitt B_f             {10:.5e}
  Ordinatenabschnitt B_f             {11:.5e}
  ------------------------------------------------------------------------
  E-Modul (Mittelwert)               {12:.5e}  kN/mm^2
    """.format(d.mean() * 1e3,
               d.std(ddof=1) * 1e3, E1 * 1e-9, dE1 * 1e-9, E2 * 1e-9, dE2 *
               1e-9, A1, dA1, A2, dA2, B1, B2, E))
Ejemplo n.º 2
0
def auswertung_einseitig(titel, datei, x, D, d, L, m, I, entf_x):
    u = L * x**2 - x**3 / 3
    entf_u = delete(u, entf_x)
    entf_D = delete(D, entf_x)
    A, dA, B, dB = linregress.linear_fit(entf_u, entf_D)

    E = (m * g) / (2 * A * I)
    dE = (m * g * dA) / (2 * A**2 * I)

    plt.grid()
    plt.title(titel)
    plt.xlabel(r"$(Lx^2 - \frac{x^3}{3})/\mathrm{m}^3$")
    plt.ylabel(r"$D/\mathrm{m}$")
    plt.plot(entf_u, entf_D, "r+")
    plt.plot(entf_u, A * entf_u + B)
    if len(u.take(entf_x)) != 0:
        plt.plot(u.take(entf_x),
                 D.take(entf_x),
                 "+",
                 label="ausgeschlossene Werte")

        plt.legend()
    plt.savefig(datei)
    plt.clf()

    print(titel + """
  ------------------------------------------------------------------------
  Durchmesser d                     ({0:.5e} ± {1:.5e})  mm
  Elastizitätsmodul E               ({2:.5e} ± {3:.5e})  kN/mm^2
  Steigung: A                        {4:.5e} ± {5:.5e}
  ------------------------------------------------------------------------
    """.format(d.mean() * 1e3,
               d.std(ddof=1) * 1e3, E * 1e-9, dE * 1e-9, A, dA))
Ejemplo n.º 3
0
def auswertung_einseitig(titel, datei, x, D, d, L, m, I, entf_x):
    u = L*x**2 - x**3/3
    entf_u = delete(u, entf_x)
    entf_D = delete(D, entf_x)
    A, dA, B, dB = linregress.linear_fit(entf_u, entf_D)

    E  = (m*g)/(2*A*I)
    dE = (m*g*dA)/(2*A**2*I)

    plt.grid()
    plt.title(titel)
    plt.xlabel(r"$(Lx^2 - \frac{x^3}{3})/\mathrm{m}^3$")
    plt.ylabel(r"$D/\mathrm{m}$")
    plt.plot(entf_u, entf_D, "r+")
    plt.plot(entf_u, A*entf_u+B)
    if len(u.take(entf_x)) != 0:
        plt.plot(u.take(entf_x), D.take(entf_x), "+", 
                 label="ausgeschlossene Werte")

        plt.legend()
    plt.savefig(datei)
    plt.clf()

    print(titel + """
  ------------------------------------------------------------------------
  Durchmesser d                     ({0:.5e} ± {1:.5e})  mm
  Elastizitätsmodul E               ({2:.5e} ± {3:.5e})  kN/mm^2
  Steigung: A                        {4:.5e} ± {5:.5e}
  ------------------------------------------------------------------------
    """.format(d.mean()*1e3, d.std(ddof=1)*1e3, E*1e-9, dE*1e-9, A, dA))
Ejemplo n.º 4
0
def auswertung_beidseitig(titel, datei, x, D, d, L, m, I):
    x1, x2 = array_split(x, 2)
    D1, D2 = array_split(D, 2)

    u1 = 3*L**2*x1 - 4*x1**3
    u2 = 4*x2**3 - 12*L*x2**2 + 9*L**2*x2 - L**3

    A1, dA1, B1, dB1 = linregress.linear_fit(u1, D1)
    A2, dA2, B2, dB2 = linregress.linear_fit(u2, D2)

    E1  = (m*g)/(48*A1*I)
    E2  = (m*g)/(48*A2*I)
    dE1 = (m*g*dA1)/(48*A1**2*I)
    dE2 = (m*g*dA2)/(48*A2**2*I)

    plt.title(titel)
    plt.subplot(211)
    plt.grid()
    plt.xlabel(r"$(3L^2x - 4x^3)/\mathrm{m}^3$")
    plt.ylabel(r"$D/\mathrm{m}$")
    plt.plot(u1, D1, "+")
    plt.plot(u1, A1*u1+B1)
    plt.subplot(212)
    plt.grid()
    plt.xlabel(r"$(4x^3 - 12Lx^2 + 9L^2x - L^3)/\mathrm{m}^3$")
    plt.ylabel(r"$D/\mathrm{m}$")
    plt.plot(u2, D2, "+")
    plt.plot(u2, A2*u2+B2)

    plt.savefig(datei)
    plt.clf()

    E = (E1+E2)/2

    print(titel + """
  ------------------------------------------------------------------------
  Durchmesser d                     ({0:.5e} ± {1:.5e})  mm
  Elastizitätsmodul E_f             ({2:.5e} ± {3:.5e})  kN/mm^2
  Elastizitätsmodul E_g             ({4:.5e} ± {5:.5e})  kN/mm^2
  Steigung A_f                       {6:.5e} ± {7:.5e}
  Steigung A_g                       {8:.5e} ± {9:.5e}
  Ordinatenabschnitt B_f             {10:.5e}
  Ordinatenabschnitt B_f             {11:.5e}
  ------------------------------------------------------------------------
  E-Modul (Mittelwert)               {12:.5e}  kN/mm^2
    """.format(d.mean()*1e3, d.std(ddof=1)*1e3, E1*1e-9, dE1*1e-9, E2*1e-9,
               dE2*1e-9, A1, dA1, A2, dA2, B1, B2, E))
Ejemplo n.º 5
0
r_wT = array(r_wT)
r_wT = r_wT / 1000  #in g/cm^3

eta_T = K_2 * (r_K2 - r_wT) * t
n1, n2, n3, n4, n5, n6, n7, n8, n9, n10 = array_split(eta_T, 10)

visko = [n1, n2, n3, n4, n5, n6, n7, n8, n9, n10]


def n(x):
    return mean(visko[x])


plot(1 / T, log(eta_T), '*', label="Messwerte")

(B, A), cov = linregress.linear_fit(1 / T, log(eta_T))


#Ausgleichsgerade
def f(x):
    return B * x + A


plot(1 / T, f(1 / T), label="Ausgleichsgerade")
xlabel("1/T in 1/s")
ylabel("ln($\eta$)")
legend(loc='lower right')
grid()
savefig("viskoseplot.pdf")
close()
Ejemplo n.º 6
0
L, C, R, R_ap = np.loadtxt('daten_und_Rap.txt', unpack=True)

########################################################################
# Teil a)

# Lade Daten und lege Ergebnis-Matrix an
minmax         = np.loadtxt('einhuellende.txt')
minima, maxima = np.vsplit(minmax.T, 2)
res            = []

for (t, U) in [maxima, minima]:
    # Plotte Meßwerte
    plt.semilogy(t, U, 'x')

    # Berechne Regressionsgerade und speichere Werte
    m, sm, b, sb = linear_fit(t, np.log(U))
    res.append([m, sm, b, sb])

    # Plotte Regressionsgerade
    x = np.linspace(t.min(), t.max())
    plt.semilogy(x, np.exp(m*x + b))

# konvertiere in numpy array
res = np.array(res)

plt.title('Bestimmung des Exponenten')
plt.ylabel('$U_C/\\mathrm{V}$')
plt.xlabel('$t/\\mathrm{s}$')
plt.ticklabel_format(axis='x',style='sci',scilimits=(1,4))
plt.grid(True, which='both')
Ejemplo n.º 7
0
Ur = Ur * 10**(-3)  #Volt

Rs = Rs * 50  #Ohm
Is = Is * 10**(-3)  #Ampere
Us = Us * 10**(-3)  #Volt

Rc = Rc * 0.5  #Ohm
Ic = Ic * 10**(-3)  #Ampere
Uc = Uc  #Volt

#1: U_K = f(I) für die Monozelle zeichnen

plot(Ig, Ug, "r*", label="Gleichspannung")

#2: Lineare Ausgleichrechnung, Steigung = -R_i, Ordinatenschnitt = U_0
(mg, yg), (dmg, dyg) = linregress.linear_fit(Ig, Ug)
(mr, yr), (dmr, dyr) = linregress.linear_fit(Ir, Ur)
(ms, ys), (dms, dys) = linregress.linear_fit(Is, Us)


def f(x, A, B):
    return A * x + B


xg = linspace(0, 0.12, 2)
plot(xg, f(xg, mg, yg), "r")

#Außerdem: Plot mit Gegenspannung

plot(Ic, Uc, "b*", label="Gegenspannung")
(mc, yc), (dmc, dyc) = linregress.linear_fit(Ic, Uc)
Ejemplo n.º 8
0
###################### Teil 5 ############################
# Abbe: Linsensystem mit f= -100 und f = 100
(gs, bs, B) = loadtxt('messwerte_abbe.txt', unpack=True)  # in cm
G = 3.8  # cm
V = B / G

plot((1 + 1 / V), gs, 'b*', label='Zu den Gegenstandsweiten')


#Ausgleichsgerade
def gerade(x, m, y):
    return m * x + y


(M1, Y1), cov1 = linregress.linear_fit((1 + 1 / V), gs)
u = linspace(min(V), max(V), 2)
plot(1 + 1 / u, gerade(1 + 1 / u, M1, Y1), "b")

#bs
plot((1 + V), bs, "r*", label='Zu den Bildweiten')
(M2, Y2), cov2 = linregress.linear_fit((1 + V), bs)
u = linspace(min(V), max(V), 2)
plot(1 + u, gerade(1 + u, M2, Y2), "r")
ylabel(' cm')
grid()
legend(loc='lower right')
savefig("abbe.pdf")
close()

#Fehlerrechnung
Ejemplo n.º 9
0
# Fehlerbalken drangeben

# Spannung, Zählrate und stat. Fehler der Zählrate in eine Matrix
plot_data = np.column_stack((U, Z, np.sqrt(Z)))
split_list = np.hsplit(plot_data.T, [2, 12])

for x, y, yerr in split_list:
    if len(x) > 2:
        ax2.errorbar(x, y, yerr=yerr, fmt='xr')
    else:
        ax2.errorbar(x, y, yerr=yerr, fmt='xb')

# lineare Ausgleichsrechnung
x = U[2:12]
y = Z[2:12]
M = linear_fit(x, y)

m = M[0]
b = M[2]

x = np.linspace(250, 750)
ax2.plot(x, m*x+b, '--g')

plt.savefig('charakteristik.pdf')
plt.close()

print('Länge des Plateau-Bereichs: {:.3f}'.format(U[12]-U[3]))
print('Parameter der Ausgleichsgeraden')
print(M)
print('Plateau-Anstieg: {:.3f}'.format( m*100/Z[2]))
Ejemplo n.º 10
0
data = np.loadtxt("stefan-boltzmann.txt", unpack=True)

T0 = 293.16 # kelvin
T = data[0] + 273.16 # kelvin
U_therm = data[1:] * 1e-6 # volts

m = np.empty(4)
Dm = np.empty(4)
b = np.empty(4)
Db = np.empty(4)

epsilon = np.empty(4)

for i in range(4):

    (a, c), (a_err, c_err) = linear_fit(T**4-T0**4, U_therm[i])

    m[i] = a
    Dm[i] = a_err
    b[i] = c
    Db[i] = c_err
    epsilon[i] = a/m[0]

# Gausssche Fehlerformel
Depsilon = np.sqrt((Dm/m[0])**2 + (m*Dm[0]/m[0]**2)**2)

name = ["Schwarz", "Weiß", "Metall (matt)", "Metall (glänzend)"]

for i in range(4):
    print(name[i]+"\n")
    print("\tm = \t{0:0.4e} +- {1:0.4e}".format(m[i], Dm[i]))
Ejemplo n.º 11
0
deltafb1 = std(fb1)/len(fb1)
deltafb2 = std(fb2)/len(fb2)

###################### Teil 5 ############################
# Abbe: Linsensystem mit f= -100 und f = 100
(gs,bs,B) = loadtxt('messwerte_abbe.txt', unpack = True) # in cm
G = 3.8 # cm
V = B/G

plot((1+ 1/V), gs, 'b*', label = 'Zu den Gegenstandsweiten')

#Ausgleichsgerade
def gerade(x,m,y):
    return m*x+y

(M1,Y1),cov1 = linregress.linear_fit((1+ 1/V), gs)
u = linspace(min(V),max(V),2)
plot(1+ 1/u, gerade(1 + 1/u,M1,Y1), "b")


#bs
plot((1+ V), bs,"r*", label = 'Zu den Bildweiten')
(M2,Y2),cov2 = linregress.linear_fit((1+V), bs)
u = linspace(min(V),max(V),2)
plot(1+u, gerade(1 + u,M2,Y2), "r")
ylabel(' cm')
grid()
legend(loc = 'lower right')
savefig("abbe.pdf")
close()
Ejemplo n.º 12
0
data = np.loadtxt("stefan-boltzmann.txt", unpack=True)

T0 = 293.16  # kelvin
T = data[0] + 273.16  # kelvin
U_therm = data[1:] * 1e-6  # volts

m = np.empty(4)
Dm = np.empty(4)
b = np.empty(4)
Db = np.empty(4)

epsilon = np.empty(4)

for i in range(4):

    (a, c), (a_err, c_err) = linear_fit(T**4 - T0**4, U_therm[i])

    m[i] = a
    Dm[i] = a_err
    b[i] = c
    Db[i] = c_err
    epsilon[i] = a / m[0]

# Gausssche Fehlerformel
Depsilon = np.sqrt((Dm / m[0])**2 + (m * Dm[0] / m[0]**2)**2)

name = ["Schwarz", "Weiß", "Metall (matt)", "Metall (glänzend)"]

for i in range(4):
    print(name[i] + "\n")
    print("\tm = \t{0:0.4e} +- {1:0.4e}".format(m[i], Dm[i]))
Ejemplo n.º 13
0
r_wT = r_wT/1000 #in g/cm^3

eta_T = K_2*(r_K2 - r_wT)*t
n1,n2,n3,n4,n5,n6,n7,n8,n9,n10 = array_split(eta_T,10)

visko = [n1,n2,n3,n4,n5,n6,n7,n8,n9,n10]

def n(x):
    return mean(visko[x])


plot(1/T, log(eta_T),'*', label = "Messwerte")



(B,A),cov = linregress.linear_fit(1/T, log(eta_T))

#Ausgleichsgerade
def f(x):
    return B*x + A

plot(1/T, f(1/T), label = "Ausgleichsgerade")
xlabel("1/T in 1/s")
ylabel("ln($\eta$)")
legend(loc = 'lower right')
grid()
savefig("viskoseplot.pdf")
close()


#Reynoldszahl (ZIMMERTEMP)
Ejemplo n.º 14
0
np.where(A == 24424)
max = x[16]

plt.xlabel("Effektive Weglänge in mm")
plt.ylabel("Anzahl der Impulse")
plt.title("Bestimmung der mittleren Weglänge")
plt.plot(x, A, "x")
plt.axvline(max, linestyle='--')
plt.grid()
plt.savefig('abstand-3cm.pdf')
plt.close()

values_to_use = np.arange(0, len(x) - 5)

M = (max / 3.1)**(2.0 / 3) / E[0] * E
(A, B), (sA, sB) = linear_fit(x.take(values_to_use), M.take(values_to_use))

plt.title("Bestimmung des Energieverlustes $\mathrm{d}E_\\alpha/\mathrm{d}x$")
plt.xlabel("Effektive Weglänge in mm")
plt.ylabel("Energie der Teilchen in MeV")
plt.plot(x[17:], M[17:], "x", label="ausgeschlossene Werte")
plt.plot(x[:16], M[:16], "rx", label="Werte für die lin. Regression")
plt.plot(x[:16], A * x[:16] + B)
plt.legend()
plt.grid()
plt.savefig('abstand-3cm-energ.pdf')
plt.close()

print("Mittlere Reichweite der Alpha-Teilchen: {0:.3e} mm".format(max))
print("Energie des Alpha-Teilchen: {0:.3e}".format((max / 3.1)**(2.0 / 3)))
print("Energieverlust -dE/dx = {0:.3f}+-{1:.3f}".format(-A, sA))
Ejemplo n.º 15
0
Us = Us*10**(-3)#Volt

Rc = Rc*0.5 #Ohm
Ic = Ic*10**(-3)#Ampere
Uc = Uc#Volt


#1: U_K = f(I) für die Monozelle zeichnen

plot(Ig,Ug,"r*",label="Gleichspannung")




#2: Lineare Ausgleichrechnung, Steigung = -R_i, Ordinatenschnitt = U_0
(mg,yg),(dmg,dyg) = linregress.linear_fit(Ig,Ug)
(mr,yr),(dmr,dyr) = linregress.linear_fit(Ir,Ur)
(ms,ys),(dms,dys) = linregress.linear_fit(Is,Us)

def f(x,A,B):
    return A*x+B

xg= linspace(0,0.12,2)
plot(xg,f(xg,mg,yg),"r")


#Außerdem: Plot mit Gegenspannung

plot(Ic,Uc,"b*",label="Gegenspannung")
(mc,yc),(dmc,dyc) = linregress.linear_fit(Ic,Uc)
xc = linspace(0,0.12,2)
Ejemplo n.º 16
0
(a,T) = loadtxt("eigentraegheitsmoment.txt",unpack=True)

T = T/3 # Periodendauer in s
a = a*10**(-2) #meter
Rz=3.5/2*10**(-2) #meter
hz=3*10**(-2) #meter

m1=223.89/1000 #kg
m2=221.71/1000 #kg
m12=445.62/1000 # kg
m = (m1,m2,m12/2)
M = mean(m)
dM = mean(m)/sqrt(len(m))

#Ausgleichsgerade
(A,dA,B,dB) = linregress.linear_fit(a*a,T*T)

def f(x):
    return A*x+B

x = linspace(0,0.1,2)
grid()
plot(x,f(x),label="Ausgleichsgerade")
plot(a*a,T*T,"*",label="Messwerte")
xlabel("$a^2$ in $m^2$")
ylabel("$T^2$ in $s^2$")
legend(loc="lower right")
savefig("steiner.pdf")

Ix = mean(D)*B/(4*pi**2)-2*M*(Rz**2/4 + hz**2/12)  #-Is des Stabes!!!!
Ejemplo n.º 17
0
(a, T) = loadtxt("eigentraegheitsmoment.txt", unpack=True)

T = T / 3  # Periodendauer in s
a = a * 10**(-2)  #meter
Rz = 3.5 / 2 * 10**(-2)  #meter
hz = 3 * 10**(-2)  #meter

m1 = 223.89 / 1000  #kg
m2 = 221.71 / 1000  #kg
m12 = 445.62 / 1000  # kg
m = (m1, m2, m12 / 2)
M = mean(m)
dM = mean(m) / sqrt(len(m))

#Ausgleichsgerade
(A, dA, B, dB) = linregress.linear_fit(a * a, T * T)


def f(x):
    return A * x + B


x = linspace(0, 0.1, 2)
grid()
plot(x, f(x), label="Ausgleichsgerade")
plot(a * a, T * T, "*", label="Messwerte")
xlabel("$a^2$ in $m^2$")
ylabel("$T^2$ in $s^2$")
legend(loc="lower right")
savefig("steiner.pdf")
Ejemplo n.º 18
0
np.where(A==24424)
max = x[16]

plt.xlabel("Effektive Weglänge in mm")
plt.ylabel("Anzahl der Impulse")
plt.title("Bestimmung der mittleren Weglänge")
plt.plot(x, A, "x")
plt.axvline(max, linestyle='--')
plt.grid()
plt.savefig('abstand-3cm.pdf')
plt.close()

values_to_use = np.arange(0, len(x)-5)

M = (max/3.1)**(2.0/3)/E[0] * E
(A, B), (sA, sB) = linear_fit(x.take(values_to_use), M.take(values_to_use))

plt.title("Bestimmung des Energieverlustes $\mathrm{d}E_\\alpha/\mathrm{d}x$")
plt.xlabel("Effektive Weglänge in mm")
plt.ylabel("Energie der Teilchen in MeV")
plt.plot(x[17:], M[17:], "x", label="ausgeschlossene Werte")
plt.plot(x[:16], M[:16], "rx",
         label="Werte für die lin. Regression")
plt.plot(x[:16], A*x[:16]+B)
plt.legend()
plt.grid()
plt.savefig('abstand-3cm-energ.pdf')
plt.close()

print("Mittlere Reichweite der Alpha-Teilchen: {0:.3e} mm".format(max))
print("Energie des Alpha-Teilchen: {0:.3e}".format((max / 3.1)**(2.0/3)))