von Fedex998 » Mo 3. Dez 2018, 22:29
Hallo Vielen Dank erstmals für die Verbesserung meines Codes!!
Ich habe in der Zwischenzeit selbst ein wenig herumprobiert und bin sogar auf mein gewünschtes Ergebniss gekommen. Es hat mich zwar sehr gewundert, das es funktioniert hat.
Ist das so ellegant oder geht das besser?
%Tabellen nebeneinder gesetzt
\begin{table}[ht]
\setlength{\tabcolsep}{12pt}
\begin{minipage}[t]{0.45\textwidth}
\begin{tabular}[ht]{
p{0.15\textwidth}
p{0.25\textwidth}
p{0.15\textwidth}
}
\toprule
$U$/\si{\V} & \multicolumn{2}{c}{$I$/\si{\mA}}\\
\cmidrule{2-3}
& \SI{100}{\ohm} & \SI{330}{\ohm}\\
\midrule
0 & 0 & 0\\
2 & 20,06 & 6,07\\
4 & 40,20 & 12,07\\
6 & 59,10 & 18,27\\
8 & 79,50 & 24,34\\
10 & 98,00 & 30,28\\
12 & 118,30 & 36,38\\
\bottomrule
\end{tabular}
\caption{Ohmsches Gesetz Versuch 1}
\label{tab:Ohmsches Gesetz Versuch 1}
\end{minipage}
\hfill
\begin{minipage}[t]{0.45\textwidth}
\begin{tabular}[ht]{
p{0.15\textwidth}
p{0.25\textwidth}
p{0.15\textwidth}
p{0.15\textwidth}
}
\toprule
$R$/\si{\ohm} & \multicolumn{3}{c}{$I$/\si{\mA}} \\
\cmidrule{2-4}
& 12V & 8V & 4V\\
\midrule
100 & 118,20 & 79,30 & 39,60\\
220 & 54,60 & 36,69 & 18,33\\
330 & 36,32 & 24,04 & 12,15\\
470 & 25,73 & 17,07 & 8,61\\
680 & 17,67 & 11,70 & 5,91\\
1000 & 12,10 & 8,03 & 4,05\\
\bottomrule
\end{tabular}
\caption{Ohmsches Gesetz Versuch 2}
\label{tab:Ohmsches Gesetz Versuch 2}
\end{minipage}
\end{table}
%Diagramm erstellt ebenfalls nebeneinander
\begin{filecontents}{Daten_Ohmsches_Gesetz_Versuch_1.csv}
U R100 R330
0 0 0
2 20.06 6.07
4 40.2 12.07
6 59.1 18.27
8 79.5 24.34
10 98.0 30.28
12 118.3 36.32
\end{filecontents}
\begin{filecontents}{Daten_Ohmsches_Gesetz_Versuch_2.csv}
R U12V U8V U4V
100 118.20 79.30 39.60
220 54.06 36.69 18.33
330 36.32 24.04 12.15
470 25.73 17.07 8.61
680 17.67 11.70 5.91
1000 12.10 8.03 4.05
\end{filecontents}
\begin{figure}[htb]
\centering
\begin{minipage}[t]{0.45\textwidth}
\centering
\begin{tikzpicture}
\begin{axis}[
grid=major,
xlabel = Spannung/V,
ylabel = Strom/mA,
domain=0.125:220,
xmin=0, xmax=15,
ymin=0, ymax=130,
samples=400,
axis y line=center,
axis x line=middle,
label style={at={(ticklabel cs:0.5)},anchor=near ticklabel,sloped}
]
\addplot table [x=U, y=R100] {Daten_Ohmsches_Gesetz_Versuch_1.csv}node[above,pos=1] {$100 \Omega$};
\addplot table [x=U, y=R330] {Daten_Ohmsches_Gesetz_Versuch_1.csv}node[above,pos=1] {$330 \Omega$};;
\end{axis}
\end{tikzpicture}
\caption{Stromkennlinie in Abhängigkeit der Spannung}
\label{fig:Stromkennlinie in Abhängigkeit der Spannung}
\end{minipage}
\hfill
\begin{minipage}[t]{0.45\textwidth}
\centering
\begin{tikzpicture}
\begin{axis}[
grid=major,
xlabel = Widerstand/$\Omega$,
ylabel = Strom/mA,
domain=0.125:220,
xmin=0, xmax=1100,
ymin=0, ymax=130,
samples=400,
axis y line=center,
axis x line=middle,
label style={at={(ticklabel cs:0.5)},anchor=near ticklabel,sloped}
]
\addplot table [x=R, y=U12V] {Daten_Ohmsches_Gesetz_Versuch_2.csv}node[above,pos=0] {$12V$};
\addplot table [x=R, y=U8V] {Daten_Ohmsches_Gesetz_Versuch_2.csv}node[above,pos=0] {$8V$};
\addplot table [x=R, y=U4V] {Daten_Ohmsches_Gesetz_Versuch_2.csv}node[above,pos=0] {$4V$};;
\end{axis}
\end{tikzpicture}
\caption{Stromkennlinie in Abhängigkeit des Widerstandes}
\label{fig:Stromkennlinie in Abhängigkeit des Widerstandes}
\end{minipage}
\end{figure}
Hallo Vielen Dank erstmals für die Verbesserung meines Codes!!
Ich habe in der Zwischenzeit selbst ein wenig herumprobiert und bin sogar auf mein gewünschtes Ergebniss gekommen. Es hat mich zwar sehr gewundert, das es funktioniert hat.
Ist das so ellegant oder geht das besser?
[code]
%Tabellen nebeneinder gesetzt
\begin{table}[ht]
\setlength{\tabcolsep}{12pt}
\begin{minipage}[t]{0.45\textwidth}
\begin{tabular}[ht]{
p{0.15\textwidth}
p{0.25\textwidth}
p{0.15\textwidth}
}
\toprule
$U$/\si{\V} & \multicolumn{2}{c}{$I$/\si{\mA}}\\
\cmidrule{2-3}
& \SI{100}{\ohm} & \SI{330}{\ohm}\\
\midrule
0 & 0 & 0\\
2 & 20,06 & 6,07\\
4 & 40,20 & 12,07\\
6 & 59,10 & 18,27\\
8 & 79,50 & 24,34\\
10 & 98,00 & 30,28\\
12 & 118,30 & 36,38\\
\bottomrule
\end{tabular}
\caption{Ohmsches Gesetz Versuch 1}
\label{tab:Ohmsches Gesetz Versuch 1}
\end{minipage}
\hfill
\begin{minipage}[t]{0.45\textwidth}
\begin{tabular}[ht]{
p{0.15\textwidth}
p{0.25\textwidth}
p{0.15\textwidth}
p{0.15\textwidth}
}
\toprule
$R$/\si{\ohm} & \multicolumn{3}{c}{$I$/\si{\mA}} \\
\cmidrule{2-4}
& 12V & 8V & 4V\\
\midrule
100 & 118,20 & 79,30 & 39,60\\
220 & 54,60 & 36,69 & 18,33\\
330 & 36,32 & 24,04 & 12,15\\
470 & 25,73 & 17,07 & 8,61\\
680 & 17,67 & 11,70 & 5,91\\
1000 & 12,10 & 8,03 & 4,05\\
\bottomrule
\end{tabular}
\caption{Ohmsches Gesetz Versuch 2}
\label{tab:Ohmsches Gesetz Versuch 2}
\end{minipage}
\end{table}
%Diagramm erstellt ebenfalls nebeneinander
\begin{filecontents}{Daten_Ohmsches_Gesetz_Versuch_1.csv}
U R100 R330
0 0 0
2 20.06 6.07
4 40.2 12.07
6 59.1 18.27
8 79.5 24.34
10 98.0 30.28
12 118.3 36.32
\end{filecontents}
\begin{filecontents}{Daten_Ohmsches_Gesetz_Versuch_2.csv}
R U12V U8V U4V
100 118.20 79.30 39.60
220 54.06 36.69 18.33
330 36.32 24.04 12.15
470 25.73 17.07 8.61
680 17.67 11.70 5.91
1000 12.10 8.03 4.05
\end{filecontents}
\begin{figure}[htb]
\centering
\begin{minipage}[t]{0.45\textwidth}
\centering
\begin{tikzpicture}
\begin{axis}[
grid=major,
xlabel = Spannung/V,
ylabel = Strom/mA,
domain=0.125:220,
xmin=0, xmax=15,
ymin=0, ymax=130,
samples=400,
axis y line=center,
axis x line=middle,
label style={at={(ticklabel cs:0.5)},anchor=near ticklabel,sloped}
]
\addplot table [x=U, y=R100] {Daten_Ohmsches_Gesetz_Versuch_1.csv}node[above,pos=1] {$100 \Omega$};
\addplot table [x=U, y=R330] {Daten_Ohmsches_Gesetz_Versuch_1.csv}node[above,pos=1] {$330 \Omega$};;
\end{axis}
\end{tikzpicture}
\caption{Stromkennlinie in Abhängigkeit der Spannung}
\label{fig:Stromkennlinie in Abhängigkeit der Spannung}
\end{minipage}
\hfill
\begin{minipage}[t]{0.45\textwidth}
\centering
\begin{tikzpicture}
\begin{axis}[
grid=major,
xlabel = Widerstand/$\Omega$,
ylabel = Strom/mA,
domain=0.125:220,
xmin=0, xmax=1100,
ymin=0, ymax=130,
samples=400,
axis y line=center,
axis x line=middle,
label style={at={(ticklabel cs:0.5)},anchor=near ticklabel,sloped}
]
\addplot table [x=R, y=U12V] {Daten_Ohmsches_Gesetz_Versuch_2.csv}node[above,pos=0] {$12V$};
\addplot table [x=R, y=U8V] {Daten_Ohmsches_Gesetz_Versuch_2.csv}node[above,pos=0] {$8V$};
\addplot table [x=R, y=U4V] {Daten_Ohmsches_Gesetz_Versuch_2.csv}node[above,pos=0] {$4V$};;
\end{axis}
\end{tikzpicture}
\caption{Stromkennlinie in Abhängigkeit des Widerstandes}
\label{fig:Stromkennlinie in Abhängigkeit des Widerstandes}
\end{minipage}
\end{figure}
[/code]