SHARE
TWEET

Binomialverteilung Histogram LaTeX

a guest Sep 21st, 2019 201 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. \begin{tikzpicture}[
  2.     declare function={binom(\k,\n,\p)=\n!/(\k!*(\n-\k)!)*\p^\k*(1-\p)^(\n-\k);}]
  3.    
  4.     % Hier p und n aendern
  5.     \newcommand{\p}{0.3}
  6.     \newcommand{\n}{10}
  7.    
  8.     \begin{axis}[
  9.     samples at={0,...,\n},
  10.     xtick={0,...,\n}, %Kommentar entfernen, wenn alle Zahlen auf der x-Achse angezeigt werden sollen
  11.     xtick pos=left,
  12.     ytick pos=left,
  13.     xlabel={k (Anzahl der Treffer)},
  14.     ylabel={P(X=k)},
  15.     yticklabel style={
  16.         /pgf/number format/fixed,
  17.         /pgf/number format/fixed zerofill,
  18.         /pgf/number format/precision=2
  19.     },
  20.     ybar=0pt, bar width=1,
  21.     ymajorgrids
  22.     ]
  23.     \addplot[fill=gray, fill opacity=1] {binom(x,\n,\p)};
  24.     \end{axis}
  25. \end{tikzpicture}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top