在这张图片中我希望两个高斯相互重叠:
这是一个最小工作示例:
\begin{center}
\tikzstyle{hidden}=[circle,fill=white!25,minimum size=120pt,inner sep=0pt, path picture={
\draw[blue,thick,-] plot[domain=-4.5:4.5,samples=50,smooth] ({\x},{4*g(\x)});
},]
\begin{tikzpicture}[scale=0.95]
\node (h2)[hidden] at (-2, 0){};
\node (h1)[hidden] at (2, 0){};
\node(S_1)[above] at (2,2.1) {$pdf(r|S_1)$};
\node(S_2)[above] at (-2,2.1) {$pdf(r|S_2)$};
\def\x{1} % replace 1 with desired value here
\def\x{1} % replace 1 with desired value here
\draw[->] (-4,0) -- (4,0) node[right] {$\Psi$};
\draw[dashed] (0,-0.25) -- (0,2);
\draw[-, thick](0,0.1) -- (0,-0.1);
\foreach \Point in { (-2,0), (2,0) }{
\node at \Point {$\bullet$};}
\foreach \Point in { (1.72,0), (1.91,0),(2.18,0),(-2.08,0),(-1.9,0),(-1.72,0),(2.08,0),(-2.18,0),(1.52,0), (1.31,0),(2.38,0),(-2.48,0),(-1.2,0),(-1.47,0),(2.6,0),(-2.68,0) }{
\node at \Point {\small $\ast$};}
\node [below] at (-0.1,-0.1) {$0$};
\node [below] at (-2.1,-0.1) {$-A$};
\node [below] at (2.1,-0.1) {$+A$};
\end{tikzpicture}
\end{center}
第二个显示出来的都是这个,但我希望它们两个互相重叠。我该如何实现?也许类似hold
MATLAB 中的想法可行,但我不知道 Tikz/LaTeX 中是否存在这种想法。
高斯定义如下:
\tikzset{
declare function={
sig = 0.95;
mu = 0;
g(\x) = 1/(sig*sqrt(2*pi)) * exp(-1/2 * ((\x-mu)/sig)^2);
}
}