![Problem beim Plotten mit pgfplots](https://rvso.com/image/298817/Problem%20beim%20Plotten%20mit%20pgfplots.png)
Ich versuche, die Exponentialfunktion mithilfe von darzustellen
pgfplots
, aber egal, was ich ändere, ich erhalte nur einen Teil der Darstellung.
Hier ist der Code (der Code und das Bild wurden mit exp(0,25x) statt exp(0,25x-5) erstellt, aber ich erhalte trotzdem in beiden Fällen ein ähnliches Ergebnis):
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\begin{document}
\hspace{15mm}
\begin{tikzpicture}
\begin{axis}[xmin=-5,xmax=15,ymin=0,ymax=1,ylabel= $\mathbb{P}(x)$,xlabel=$x$,
no markers,samples=100,grid=both]
\addplot {1/(1+exp(0.25*x))};
\end{axis}
\end{tikzpicture}
\end{document}
Und hier ist die Handlung, die ich verstehe:
Antwort1
Durch Hinzufügen domain=-5:15
wird das Problem für beide Funktionen gelöst:
Anmerkungen:
- Ich bin nicht sicher, warum ich
pgfplots
die Domäne nicht einfach ausxmin
und extrahiert habexmax
.
Code:
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\begin{document}
\hspace{15mm}
\begin{tikzpicture}
\begin{axis}[xmin=-5,xmax=15,ymin=0,ymax=1,ylabel= $\mathbb{P}(x)$,xlabel=$x$,
no markers,samples=100,grid=both,domain=-5:15]
\addplot+ [ultra thick] {1/(1+exp(0.25*x))};
\addplot+ [ultra thick] {1/(1+exp(0.25*x-5))};
\end{axis}
\end{tikzpicture}
\end{document}