mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-19 11:38:05 +02:00
added CDF
This commit is contained in:
parent
67debb0b28
commit
9549ecdd04
4 changed files with 79 additions and 0 deletions
|
@ -0,0 +1,31 @@
|
|||
SOURCE = normal-distribution-cumulative-density-function
|
||||
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).svg
|
||||
# Necessary, as pdf2svg does not always create valid svgs:
|
||||
inkscape $(SOURCE).svg --export-width=$(WIDTH) --export-plain-svg=$(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: 16 KiB |
|
@ -0,0 +1,40 @@
|
|||
\documentclass[varwidth=true, border=2pt]{standalone}
|
||||
|
||||
\usepackage{amsmath}
|
||||
\usepackage{pgfplots}
|
||||
|
||||
\def\cdf(#1)(#2)(#3){0.5*(1+(erf((#1-#2)/(#3*sqrt(2)))))}%
|
||||
% to be used: \cdf(x)(mean)(variance)
|
||||
|
||||
\DeclareMathOperator{\CDF}{cdf}
|
||||
|
||||
\begin{document}
|
||||
\begin{tikzpicture}
|
||||
\begin{axis}[
|
||||
legend pos=north west,
|
||||
axis x line=middle,
|
||||
axis y line=middle,
|
||||
grid = major,
|
||||
width=8cm,
|
||||
height=6cm,
|
||||
grid style={dashed, gray!30},
|
||||
xmin=-5.1, % start the diagram at this x-coordinate
|
||||
xmax= 5.1, % end the diagram at this x-coordinate
|
||||
ymin=-0.1, % start the diagram at this y-coordinate
|
||||
ymax= 1.1, % end the diagram at this y-coordinate
|
||||
%axis background/.style={fill=white},
|
||||
x label style={at={(axis description cs:0.5,0)},anchor=north},
|
||||
y label style={at={(axis description cs:0,.5)},rotate=90,anchor=south},
|
||||
xlabel=$x$,
|
||||
ylabel=$\Phi_{\mu, \sigma^2}(x)$,
|
||||
%xticklabels={-2,-1.6,...,7},
|
||||
%yticklabels={-8,-7,...,8},
|
||||
tick align=outside,
|
||||
minor tick num=-3,
|
||||
enlargelimits=false,
|
||||
tension=0.08]
|
||||
\addplot[domain=-5.2:5.2,smooth,red!70!black,very thick,samples=200,] gnuplot{\cdf(x)(0)(1)};
|
||||
\addlegendentry{$\sigma^2 = 1$}
|
||||
\end{axis}
|
||||
\end{tikzpicture}
|
||||
\end{document}
|
Loading…
Add table
Add a link
Reference in a new issue