mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-28 23:37:57 +02:00
added normal distribution image
This commit is contained in:
parent
47dec60918
commit
8d93d70e1b
4 changed files with 106 additions and 0 deletions
|
@ -0,0 +1,32 @@
|
|||
SOURCE = normal-distribution-cumulative-density-function-many
|
||||
DELAY = 80
|
||||
DENSITY = 300
|
||||
WIDTH = 512
|
||||
|
||||
make:
|
||||
pdflatex -shell-escape $(SOURCE).tex -output-format=pdf
|
||||
make clean
|
||||
|
||||
clean:
|
||||
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
|
||||
|
||||
gif:
|
||||
pdfcrop $(SOURCE).pdf
|
||||
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
|
||||
make clean
|
||||
|
||||
png:
|
||||
make
|
||||
make svg
|
||||
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
|
||||
|
||||
transparentGif:
|
||||
convert $(SOURCE).pdf -transparent white result.gif
|
||||
make clean
|
||||
|
||||
svg:
|
||||
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
|
||||
pdf2svg $(SOURCE).pdf $(SOURCE)1.svg
|
||||
# Necessary, as pdf2svg does not always create valid svgs:
|
||||
inkscape $(SOURCE)1.svg --export-width=$(WIDTH) --export-plain-svg=$(SOURCE)1.svg
|
||||
rsvg-convert -a -w 720 -f svg $(SOURCE)1.svg -o $(SOURCE).svg
|
|
@ -0,0 +1,8 @@
|
|||
Compiled example
|
||||
----------------
|
||||

|
||||
|
||||
Credits
|
||||
-------
|
||||
|
||||
This image is based on the one of [Claudio Fiandrino](http://tex.stackexchange.com/a/60956/5645).
|
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
|
@ -0,0 +1,66 @@
|
|||
\documentclass[varwidth=true, border=4pt]{article}
|
||||
\usepackage[active,tightpage]{preview}
|
||||
\usepackage[latin1]{inputenc}
|
||||
\usepackage{amsmath}
|
||||
\usepackage{pgfplots}
|
||||
\usepackage{helvet}
|
||||
\usepackage[eulergreek]{sansmath}
|
||||
|
||||
\def\cdf(#1)(#2)(#3){0.5*(1+(erf((#1-#2)/(sqrt(#3*2)))))}%
|
||||
% to be used: \cdf(x)(mean)(variance)
|
||||
|
||||
\DeclareMathOperator{\CDF}{cdf}
|
||||
|
||||
\pgfplotsset{
|
||||
tick label style = {font=\sansmath\sffamily},
|
||||
every axis label/.append style={font=\sffamily\footnotesize},
|
||||
}
|
||||
|
||||
\begin{document}
|
||||
\begin{preview}
|
||||
\begin{tikzpicture}
|
||||
\begin{axis}[
|
||||
width=13.5cm,
|
||||
height=8.625cm,
|
||||
% Grid
|
||||
grid = major,
|
||||
grid style={black, thin},
|
||||
% size
|
||||
xmin=-5.25, % start the diagram at this x-coordinate
|
||||
xmax= 5.25, % end the diagram at this x-coordinate
|
||||
ymin=-0.05, % start the diagram at this y-coordinate
|
||||
ymax= 1.05, % end the diagram at this y-coordinate
|
||||
% Legende
|
||||
legend pos=north west,
|
||||
legend style={font=\footnotesize},
|
||||
% Ticks
|
||||
tick align=inside,
|
||||
minor tick num=3,
|
||||
minor tick style={thick},
|
||||
yticklabel style={
|
||||
/pgf/number format/precision=1,
|
||||
/pgf/number format/fixed,
|
||||
/pgf/number format/fixed zerofill},
|
||||
% Axis
|
||||
axis line style = very thick,
|
||||
xlabel=$x$,
|
||||
x label style={at={(axis description cs:0.5,0)},
|
||||
anchor=north,
|
||||
font=\boldmath\Large},
|
||||
ylabel=$\Phi_{\mu, \sigma^2}(x)$,
|
||||
y label style={at={(axis description cs:0.05,0.5)},
|
||||
anchor=south,
|
||||
font=\boldmath\Large},
|
||||
]
|
||||
\addplot[domain=-5.25:5.25,smooth,blue!70!black,ultra thick,samples=200,] gnuplot{\cdf(x)(0)(0.2)};
|
||||
\addplot[domain=-5.25:5.25,smooth,red!70!black,ultra thick,samples=200,] gnuplot{\cdf(x)(0)(1.0)};
|
||||
\addplot[domain=-5.25:5.25,smooth,yellow!80!black,ultra thick,samples=200,] gnuplot{\cdf(x)(0)(5)};
|
||||
\addplot[domain=-5.25:5.25,smooth,green!70!black,ultra thick,samples=200,] gnuplot{\cdf(x)(-2)(0.5)};
|
||||
\addlegendentry{$\mu=\hphantom{-}0,\quad \sigma^2 = 0.2$}
|
||||
\addlegendentry{$\mu=\hphantom{-}0,\quad \sigma^2 = 1.0$}
|
||||
\addlegendentry{$\mu=\hphantom{-}0,\quad \sigma^2 = 5.0$}
|
||||
\addlegendentry{$\mu=-2,\quad \sigma^2 = 0.5$}
|
||||
\end{axis}
|
||||
\end{tikzpicture}
|
||||
\end{preview}
|
||||
\end{document}
|
Loading…
Add table
Add a link
Reference in a new issue