summaryrefslogtreecommitdiffstats
path: root/fiz
diff options
context:
space:
mode:
Diffstat (limited to 'fiz')
-rw-r--r--fiz/vaje/10/.gitignore1
-rw-r--r--fiz/vaje/10/dokument.lyx49
-rwxr-xr-xfiz/vaje/10/tab.py22
3 files changed, 54 insertions, 18 deletions
diff --git a/fiz/vaje/10/.gitignore b/fiz/vaje/10/.gitignore
index 8c9c1c2..da2a8f9 100644
--- a/fiz/vaje/10/.gitignore
+++ b/fiz/vaje/10/.gitignore
@@ -1,3 +1,4 @@
*.csv
p.tsv
podatki.lyx
+graf.tex
diff --git a/fiz/vaje/10/dokument.lyx b/fiz/vaje/10/dokument.lyx
index 3209653..bf0df5c 100644
--- a/fiz/vaje/10/dokument.lyx
+++ b/fiz/vaje/10/dokument.lyx
@@ -124,10 +124,10 @@ Teoretični model
\begin_inset Formula $s_{0}\left(\nu\right)$
\end_inset
- je
+ harmoničnega nihala s tremi parametri je
\begin_inset Formula
\[
-s_{0}=A\frac{\omega}{\sqrt{\left(\omega^{2}+\omega_{0}^{2}\right)^{2}+4\beta^{2}\omega^{2}}}\text{{,}}
+s_{0}=\frac{A}{\sqrt{\left(B^{2}-\omega^{2}\right)^{2}+C^{2}\omega^{2}}}\text{{,}}
\]
\end_inset
@@ -145,15 +145,6 @@ kjer je
\end_inset
.
- Resonančna frekvenca, razbrana iz grafa — vrh, je
-\begin_inset Formula $6,5$
-\end_inset
-
- radianov na sekundo, kar je
-\begin_inset Formula $6,5\pi2$
-\end_inset
-
- nihajev na sekundo.
\end_layout
\begin_layout Standard
@@ -975,7 +966,8 @@ status open
\begin_inset Caption Standard
\begin_layout Plain Layout
-Izmerjeni in izračunani podatki
+Izmerjeni in izračunani podatki.
+ Podatek o amplitudi je natančen na milimeter.
\end_layout
\end_inset
@@ -986,6 +978,10 @@ Izmerjeni in izračunani podatki
\end_inset
+\begin_inset Note Note
+status open
+
+\begin_layout Plain Layout
\begin_inset Float figure
placement H
wide false
@@ -1044,14 +1040,14 @@ addlegendentry{meritve}
\backslash
-addplot[blue] (x, {0.490752637*x/sqrt((x^2+6.6^2)^2+4*(-0.000179148908)^2*x^2)});
+addplot[blue] (x, {0.47583543/sqrt(-6.87050654^2-x^2)^2+1.2365817^2*x^2});
\end_layout
\begin_layout Plain Layout
\backslash
-addlegendentry{Teoretični model}
+addlegendentry{$A=0.47583543$, $B=-6.87050654$, $C=1.2365817$}
\end_layout
\begin_layout Plain Layout
@@ -1224,8 +1220,31 @@ name "fig:graf-1"
\end_layout
+\end_inset
+
+
+\end_layout
+
\begin_layout Standard
-Meritve se ne ujemajo z napovedano vrednostjo.
+\begin_inset CommandInset include
+LatexCommand input
+filename "graf.tex"
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Standard
+Iz grafa za harmonično nihanje razberemo 6,819 kot
+\begin_inset Formula $\omega_{0}$
+\end_inset
+
+, kar pomeni, da je resonančna frekvenca matematičnega nihala
+\begin_inset Formula $\SI{1,085}{\per\second}$
+\end_inset
+
+.
\end_layout
\end_body
diff --git a/fiz/vaje/10/tab.py b/fiz/vaje/10/tab.py
index c5c24db..2b0bbae 100755
--- a/fiz/vaje/10/tab.py
+++ b/fiz/vaje/10/tab.py
@@ -1,7 +1,11 @@
#!/usr/bin/python3
import pandas
-import sys
+from sys import argv, stderr
from math import pi
+from numpy import sqrt, arange, argmax
+from scipy.optimize import curve_fit
+from matplotlib import pyplot
+from tikzplotlib import get_tikz_code
l = 23.5
df = pandas.read_csv("podatki.tsv", sep="\t")
df.index.name = "idx"
@@ -9,6 +13,18 @@ df["x"] = (df["y"]/13*l)
df["omega"] = ((9.81/df["l"])**(1/2))
df["f"] = (df["omega"]*0.5/pi)
df = df.astype(float).round(6);
-data = df.values
+def objective(x, A, B, C):
+ return A/sqrt((B**2-x**2)**2+C**2*x**2)
+popt, _ = curve_fit(objective, df.values[:, 3], df.values[:, 2])
+print(popt, file=stderr)
+pyplot.scatter(df.values[:, 3], df.values[:, 2])
+iksi = arange(min(df.values[:, 3]), max(df.values[:, 3]), 0.01)
+ipsiloni = objective(iksi, popt[0], popt[1], popt[2])
+print(f"omega nič je {iksi[argmax(ipsiloni)]}, kar je {iksi[argmax(ipsiloni)]/2/pi} Hz", file=stderr)
+pyplot.plot(iksi, ipsiloni, "--", color="red")
+pyplot.xlabel('$s_0 \\left[\\si{\\meter}\\right]$')
+pyplot.ylabel('$\\omega=2\\pi\\nu$')
+pyplot.title("$s_0\\left(\\omega\\right)$")
if __name__ == "__main__":
- df.to_csv("/dev/stdout", sep=",");
+ # df.to_csv("/dev/stdout", sep=argv[1][0]);
+ print(get_tikz_code(axis_width="0.75\\textwidth"))