tikzpicture 具有累积分布函数

tikzpicture 具有累积分布函数

我正在尝试在 tikz 环境中重新创建这张图片。

与 CDF 一起射精

但是我发现并改变了累积分布函数。

我目前拥有的 在此处输入图片描述

\begin{tikzpicture}[scale=2]
% define normal distribution function 'normaltwo'
\def\normaltwo{\x,{2/exp(((\x-4)^2)/2)}}
% input y parameter
\def\y{5}
% this line calculates f(y)
\def\fy{2/exp(((\y-4)^2)/2)}

% Shade orange area underneath curve.
\fill [fill=orange!60] (2.6,0) -- plot[domain=0:3.5] (\normaltwo) -- ({\y-1.45},0) -- cycle;

% Draw and label normal distribution function
\draw[color=blue,domain=1:7] plot (\normaltwo) node[right] {};

% Add dashed line dropping down from normal.
\draw[-] (2,.05)--(2,-.05) node[below] {\footnotesize ${\mu}-{2}{\sigma}$};
\draw[-] (3,.05)--(3,-.05) node[below] {\footnotesize ${{\mu}-{\sigma}}$};
\draw[-] (3.55,.005)--(3.55,-.05) node[below] {\footnotesize ${x}$};
\draw[-] (4,.05)--(4,-.05) node[below] {\footnotesize ${\mu}$};
\draw[-] (5,.05)--(5,-.05) node[below] {\footnotesize ${\mu}+{\sigma}$};
\draw[-] (6,.05)--(6,-.05) node[below] {\footnotesize ${\mu}+{2}{\sigma}$};
% Optional: Add axis labels
\draw (-.2,2.5) ;
\draw (3,-.5) ;
% Optional: Add axes
\draw[->] (0,0) -- (7.2,0) node[right] {${x}$};
\draw[->] (0,0) -- (0,2.5) node[above] {${y}$};


\draw[-,dashed] (7,-1)--(-.08,-1) node[left] {\footnotesize ${1}$};
\draw[-] (7,-3)--(-.08,-3) node[left] {\footnotesize ${0}$};
\draw[-] (-.08,-3)--(7,-3) node[right] {\footnotesize ${z}$-scale};
\draw[-] (0,-3)--(0,-.9) node[above] {\footnotesize ${\Phi}\gobble{\Phi..}({z}\gobble{\Phi..})$};
\draw[-] (0,-2)--(-.05,-2);

%\draw[-] (1,-2.95)--(1,-3.05) node[below] {\footnotesize $-{3}$};
\draw[-] (2,-2.95)--(2,-3.05) node[below] {\footnotesize ${-2}$};
\draw[-] (3,-2.95)--(3,-3.05) node[below] {\footnotesize ${-1}$};
\draw[-] (4,-2.95)--(4,-3.05) node[below] {\footnotesize ${0}$};
\draw[-] (5,-2.95)--(5,-3.05) node[below] {\footnotesize ${1}$};
\draw[-] (6,-2.95)--(6,-3.05) node[below] {\footnotesize ${2}$};
%\draw[-] (7,-2.95)--(7,-3.05) node[below] {\footnotesize ${3}$};

\draw[-,dashed] (2,-.3)--(2,-3);
\draw[-,dashed] (3,-.3)--(3,-3);
\draw[-,dashed] (4,-.3)--(4,-3);
\draw[-,dashed] (5,-.3)--(5,-3);
\draw[-,dashed] (6,-.3)--(6,-3);

\end{tikzpicture}

现在我只需要通过它绘制函数。我找到了一些函数,但它们与我的顶部图表不一致。我尝试嵌入atan(x-4)/2.6+.53到图表中,但没有成功。请帮忙

答案1

可能你的主要问题是你认为函数atan以弧度给出结果。但是:

在此处输入图片描述

使用:

\draw[color=blue,domain=1:7] plot (\x,{rad(atan(\x-4))/2.6+0.53});

并调整曲线位置。请注意,需要额外的括号来隐藏解析器的内部括号。

无论如何,有了 ,这种图表就会容易得多pgfplots

相关内容