mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-26 06:48:04 +02:00
37 lines
1.3 KiB
TeX
37 lines
1.3 KiB
TeX
\documentclass[varwidth=false, border=2pt]{standalone}
|
|
|
|
\usepackage{pgfplots}
|
|
\usepackage{tikz}
|
|
\usepackage{nicefrac}
|
|
\pgfplotsset{every axis legend/.append style={
|
|
at={(0,0)},
|
|
anchor=north east}}
|
|
|
|
\begin{document}
|
|
\begin{tikzpicture}
|
|
\begin{axis}[
|
|
axis x line=middle,
|
|
axis y line=middle,
|
|
grid = major,
|
|
width=16cm,
|
|
height=8cm,
|
|
grid style={dashed, gray!30},
|
|
xmin=-5, % start the diagram at this x-coordinate
|
|
xmax= 5, % end the diagram at this x-coordinate
|
|
ymin= 0, % start the diagram at this y-coordinate
|
|
ymax= 1.1, % end the diagram at this y-coordinate
|
|
xlabel=$x$,
|
|
ylabel=$y$,
|
|
legend cell align=left,
|
|
legend pos=south east,
|
|
legend style={draw=none},
|
|
tick align=outside,
|
|
enlargelimits=false]
|
|
% plot the function
|
|
\addplot[domain=-5:5, red, ultra thick,samples=500] {1/(1+exp(-1*(x - 0)))};
|
|
\addplot[domain=-5:5, blue, ultra thick,dotted,samples=500] {1/(1+exp(-2*(x - 0)))};
|
|
\addplot[domain=-5:5, green!50!black, ultra thick,dashed,samples=500] {1/(1+exp(-1*(x - 1)))};
|
|
\legend{$\frac{1}{1 + e^{-x}}$,$\frac{1}{1 + e^{-2 \cdot x}}$,$\frac{1}{1 + e^{-(x-1)}}$}
|
|
\end{axis}
|
|
\end{tikzpicture}
|
|
\end{document}
|