Interpolation zwischen mehreren Punkten

Tabellen und Grafiken erstellen und anordnen


Patrick1990
Forum-Century
Forum-Century
Beiträge: 213
Registriert: Mo 18. Feb 2013, 07:56
Wohnort: Ilmenau

Interpolation zwischen mehreren Punkten

Beitrag von Patrick1990 »

Hallo,

ich habe folgendes Problem. Ich möchte einige Messwerte unter LaTeX darstellen und dazwischen eine "Kurve" interpolieren.
Soweit funktioniert dies sehr gut, doch die Kurve ist nicht schön "flüssig".


Hier das Minimalbeispiel:
\documentclass[11pt,fleqn,numbers=noenddot]{scrartcl}

\usepackage[ngerman]{babel}
\usepackage{pgfplots,pgfplotstable} 
\usepackage[locale=DE]{siunitx} 
\usepackage{pdflscape}
\usepackage{nicefrac}

\pgfplotsset{
	compat=newest, 
	xlabel near ticks, 
	ylabel near ticks 
} 


\begin{document}

\begin{landscape}
\begin{tikzpicture}
\begin{axis}[ 
title={$\Phi$-$V_{Umlauf}$-Kennlinien},
width=1.5\textwidth,height=0.9\textheight,
axis x line=bottom, 
xmin=0, 
xmax=820,
xtick={0,80,160,240,320,400,480,560,640,720,800},
axis y line=left,
ymin=0,
ymax=0.0021, 
ytick={0,0.0001,0.0002,0.0003,0.0004,0.0005,0.0006,0.0007,0.0008,0.0009,
0.001,0.0011,0.0012,0.0013,0.0014,0.0015,0.0016,0.0017,0.0018,0.0019,0.002},
xlabel={$V_{Umlauf}$ in $\left[\si{\ampere}\right]$}, 
ylabel={$\Phi$ in$\left[\si{\volt\second}\right]$},
grid=major,
legend style={
  at={(current bounding box.north-|current axis.east)},
  anchor=east,
  legend columns=3
}
] 
\addplot+[color=red,smooth] 
coordinates {
(0,0) 
(80,			0.0005) 
(160,		0.0009) 
(240,		0.0011) 
(320,		0.0013) 
(400,		0.0014) 
(480,		0.0015)
(560,		0.0015)
(640,		0.0016)
(720,		0.0016)
(800,		0.0017)
}
;
\addlegendentry{Case 1}

\addplot+[color=blue,smooth] 
coordinates {
(0,0) 
(80,			0.0001) 
(160,		0.0003) 
(240,		0.0003) 
(320,		0.0004) 
(400,		0.0006) 
(480,		0.0006)
(560,		0.0008)
(640,		0.0009)
(720,		0.0010)
(800,		0.0011)
}
;
\addlegendentry{Case 2}
\addplot+[color=green,smooth] 
coordinates {
(0,0) 
(80,			0.0001) 
(160,		0.0001) 
(240,		0.0002) 
(320,		0.0003) 
(400,		0.0004) 
(480,		0.0005)
(560,		0.0005)
(640,		0.0006)
(720,		0.0006)
(800,		0.0007)
}
;
\addlegendentry{Case 3}
\addplot+[color=brown,smooth] 
coordinates {
(0,0) 
(80,			0.0000) 
(160,		0.0001) 
(240,		0.0001) 
(320,		0.0002) 
(400,		0.0003) 
(480,		0.0003)
(560,		0.0004)
(640,		0.0004)
(720,		0.0005)
(800,		0.0005)
}
;
\addlegendentry{Case 4}
\addplot+[color=black,smooth] 
coordinates {
(0,0) 
(80,			0) 
(160,		0.0001) 
(240,		0.0001) 
(320,		0.0001) 
(400,		0.0002) 
(480,		0.0002)
(560,		0.0003)
(640,		0.0003)
(720,		0.0003)
(800,		0.0004)
}
;
\addlegendentry{Case 5}
\legend{$\nicefrac{\delta}{2}=0$\\$\nicefrac{\delta}{2}=0,5$\\$\nicefrac{\delta}{2}=1$\\$\nicefrac{\delta}{2}=2$\\$\nicefrac{\delta}{2}=4$\\}
\end{axis} 
\end{tikzpicture}
\end{landscape}

\end{document}
und hier nochmal so, wie es aussehen sollte:
http://s7.directupload.net/images/140530/oqq3j55o.png


Vielen Dank.

esdd
Forum-Meister
Forum-Meister
Beiträge: 2561
Registriert: So 7. Feb 2010, 16:36

Beitrag von esdd »

Mir ist jetzt nicht genau klar, was du genau erreichen willst. Mit mark=none kannst du die Marker ausblenden. Die Glättung der Plots mittels smooth lässt sich dann noch über den Parameter tension=... beeinflussen. Ich habe dafür jetzt einen myplot Stil definiert. Diesen gebe ich den einzelnen Plots als Option.
\documentclass[11pt,fleqn,numbers=noenddot]{scrartcl} 

\usepackage[ngerman]{babel} 
\usepackage{pgfplots,pgfplotstable} 
\usepackage[locale=DE]{siunitx} 
\usepackage{pdflscape} 
\usepackage{nicefrac} 

\pgfplotsset{ 
    compat=newest, 
    xlabel near ticks, 
    ylabel near ticks,
    myplot/.style={smooth,tension=0.5,mark=none,very thick}
} 


\begin{document} 

\begin{landscape} 
\begin{tikzpicture} 
\begin{axis}[ 
 title={$\Phi$-$V_{Umlauf}$-Kennlinien}, 
 width=1.5\textwidth,height=0.9\textheight, 
 axis x line=bottom, 
 xmin=0, 
 xmax=820, 
 xtick={0,80,160,240,320,400,480,560,640,720,800}, 
 axis y line=left, 
 ymin=0, 
 ymax=0.0021, 
 ytick={0,0.0001,0.0002,0.0003,0.0004,0.0005,0.0006,0.0007,0.0008,0.0009,
0.001,0.0011,0.0012,0.0013,0.0014,0.0015,0.0016,0.0017,0.0018,0.0019,0.002}, 
 xlabel={$V_{Umlauf}$ in $\left[\si{\ampere}\right]$}, 
 ylabel={$\Phi$ in$\left[\si{\volt\second}\right]$}, 
 grid=major, 
 legend style={ 
   at={(current bounding box.north-|current axis.east)}, 
   anchor=east, 
   legend columns=3
} 
] 
\addplot+[color=red,myplot ] 
 coordinates { 
 (0,0) 
 (80,         0.0005) 
 (160,      0.0009) 
 (240,      0.0011) 
 (320,      0.0013) 
 (400,      0.0014) 
 (480,      0.0015) 
 (560,      0.0015) 
 (640,      0.0016) 
 (720,      0.0016) 
 (800,      0.0017) 
} 
 ; 
\addlegendentry{Case 1} 

\addplot+[color=blue,myplot ] 
 coordinates { 
 (0,0) 
 (80,         0.0001) 
 (160,      0.0003) 
 (240,      0.0003) 
 (320,      0.0004) 
 (400,      0.0006) 
 (480,      0.0006) 
 (560,      0.0008) 
 (640,      0.0009) 
 (720,      0.0010) 
 (800,      0.0011) 
} 
 ; 
\addlegendentry{Case 2} 
\addplot+[color=green,myplot ] 
 coordinates { 
 (0,0) 
 (80,         0.0001) 
 (160,      0.0001) 
 (240,      0.0002) 
 (320,      0.0003) 
 (400,      0.0004) 
 (480,      0.0005) 
 (560,      0.0005) 
 (640,      0.0006) 
 (720,      0.0006) 
 (800,      0.0007) 
} 
 ; 
\addlegendentry{Case 3} 
\addplot+[color=brown,myplot] 
 coordinates { 
 (0,0) 
 (80,         0.0000) 
 (160,      0.0001) 
 (240,      0.0001) 
 (320,      0.0002) 
 (400,      0.0003) 
 (480,      0.0003) 
 (560,      0.0004) 
 (640,      0.0004) 
 (720,      0.0005) 
 (800,      0.0005) 
} 
 ; 
\addlegendentry{Case 4} 
\addplot+[color=black,myplot] 
 coordinates { 
 (0,0) 
 (80,         0) 
 (160,      0.0001) 
 (240,      0.0001) 
 (320,      0.0001) 
 (400,      0.0002) 
 (480,      0.0002) 
 (560,      0.0003) 
 (640,      0.0003) 
 (720,      0.0003) 
 (800,      0.0004) 
} 
 ; 
\addlegendentry{Case 5} 
\legend{$\nicefrac{\delta}{2}=0$\\$\nicefrac{\delta}{2}=0,5$\\
$\nicefrac{\delta}{2}=1$\\$\nicefrac{\delta}{2}=2$\\$\nicefrac{\delta}{2}=4$\\} 
\end{axis} 
\end{tikzpicture} 
\end{landscape} 

\end{document} 
Gruß
Elke

Patrick1990
Forum-Century
Forum-Century
Beiträge: 213
Registriert: Mo 18. Feb 2013, 07:56
Wohnort: Ilmenau

Beitrag von Patrick1990 »

Vielen Dank erstmal für die Antwort.


Mein Ziel ist es, zu erreichen, dass die "Ausreißer" nicht so sehr ins Gewicht fallen, also eine Art interpolierte Kurve anhand der Punkte.

Das hochgeladene Bild aus meinem ersten Beitrag habe ich in Mathematica entworfen und "InterpolationOrder" größer gewählt.

Antworten