[Tex/LaTex] Tikzpicture e-function

tikz-pgf

I have the problem that i get an error message (dimension too large) when i try to draw an e-function:

\documentclass[BCOR=3mm,11pt,headsepline,footsepline]{scrbook}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{multirow}
\usepackage{pgf,tikz}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage[dvipdfm]{geometry}
\usepackage{tabulary}
\usepackage{subfigure}
\usepackage{float}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes,snakes}
\usepackage{ntheorem}
\geometry{
   inner=2cm,
   outer=2cm,
   top=2cm,
   bottom=2.5cm,
   head=2cm,
   footnotesep=1cm,
%   bindingoffset=1cm,
   } 


\mdtheorem[%
apptotikzsetting={\tikzset{mdfbackground/.append style=%
{top color=white,
bottom color=white},
mdfframetitlebackground/.append style =%
{top color=gray!10!white,
bottom color=gray!10!white}
}},
,roundcorner=10pt,middlelinewidth=1.3pt,
frametitlerule=true,frametitlerulewidth=1.3pt,
innertopmargin=10pt,%
]{wissen}{Fehlerschwerpunkt}
\begin{document}    
\begin{tikzpicture}[scale=0.9, >=latex,y=7cm,x=1cm]
    \draw[-angle 45,line width = 0.8pt] (-6,0) -- (6,0) node[right] {\scriptsize $x$};
    \draw[-angle 45,line width = 0.8pt] (0,-0.1) -- (0,0.5) node[above] {\scriptsize $y$};
    \foreach \x in {-5,-4,...,-1,1,2,...,5} \draw (\x, 3pt) -- (\x,-3pt) node[anchor=north] {\tiny \x};
    \foreach \y in {0.1,0.2,0.3,0.4} \draw (3pt,\y) -- (-3pt,\y) node[anchor=east] {\tiny \y};
    \draw[color=red, line width = 1pt, domain=-4:5, samples=100]     plot (\x,{(9*exp(\x))/(exp(\x)+9)^2});
    \end{tikzpicture}
\end{document}

Best Answer

For plots you are better of using pgfplots:

enter image description here

Code:

\documentclass{scrbook}
\usepackage{pgfplots}

\begin{document}    
\begin{tikzpicture}
\begin{axis}[
    axis lines=middle,
    xmax=6.9,
    xmin=-5.5,
    ymin=-0.05,
    ymax=0.35,
    xlabel={$x$},
    ylabel={$y$},
    ]
    \addplot [domain=-4:5, samples=100, ultra thick, blue] {9*exp(x)/(exp(x)+9)^2};
\end{axis}
\end{tikzpicture}
\end{document}