sigmoid-function.tex 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. \documentclass[varwidth=false, border=2pt]{standalone}
  2. \usepackage{pgfplots}
  3. \usepackage{tikz}
  4. \begin{document}
  5. \begin{tikzpicture}
  6. \begin{axis}[
  7. legend pos=north west,
  8. axis x line=middle,
  9. axis y line=middle,
  10. x tick label style={/pgf/number format/fixed,
  11. /pgf/number format/fixed zerofill,
  12. /pgf/number format/precision=1},
  13. y tick label style={/pgf/number format/fixed,
  14. /pgf/number format/fixed zerofill,
  15. /pgf/number format/precision=1},
  16. grid = major,
  17. width=16cm,
  18. height=8cm,
  19. grid style={dashed, gray!30},
  20. xmin=-1, % start the diagram at this x-coordinate
  21. xmax= 1, % end the diagram at this x-coordinate
  22. ymin= 0, % start the diagram at this y-coordinate
  23. ymax= 1, % end the diagram at this y-coordinate
  24. %axis background/.style={fill=white},
  25. xlabel=x,
  26. ylabel=y,
  27. tick align=outside,
  28. enlargelimits=false]
  29. % plot the stirling-formulae
  30. \addplot[domain=-1:1, red, ultra thick,samples=500] {1/(1+exp(-5*x))};
  31. \addplot[domain=-1:1, blue, ultra thick,samples=500] {1/(1+exp(-10*x))};
  32. \addlegendentry{$f(x)=\frac{1}{1+e^{-5x}}$}
  33. \addlegendentry{$g(x)=\frac{1}{1+e^{-10x}}$}
  34. \end{axis}
  35. \end{tikzpicture}
  36. \end{document}