我想要绘制如下图表:
图表需要看起来像两条钟形曲线。没有特定的函数或任何东西。
这是我所拥有的。
\begin{tikzpicture}
\draw[very thin,color=lightgray,step=0.5cm] (0,0) grid (6.1,3.6);
\draw[->] (0,0) -- (6.2,0) node[anchor=north] {$t$};
\draw[->] (0,0) -- (0,3.7) node[anchor=east] {$v$};
\draw
(0,0) node[anchor=north] {0}
(1,0) node[anchor=north] {10}
(2,0) node[anchor=north] {20}
(3,0) node[anchor=north] {30}
(4,0) node[anchor=north] {40}
(5,0) node[anchor=north] {50}
(0,1) node[anchor=east] {5}
(0,2) node[anchor=east] {10}
(0,3) node[anchor=east] {15};
\draw[thick,color=blue] (0,0) to [out=0,in=180] (1,3);
\draw[thick,color=blue] (1,3) to [out=0,in=180] (2,0);
\draw[thick,color=blue] (2,0) to (4,0);
\draw[thick,color=blue] (4,0) to [out=0,in=180] (5,3);
\draw[thick,color=blue] (5,3) to [out=0,in=180] (6,0);
\end{tikzpicture}
正如您所见,它看起来并不像钟形曲线。
我对 TikZ 还很陌生,这是我所知道的唯一绘图方法。请帮忙!
答案1
欢迎来到 TeX.SE!您可以绘制任意函数。请注意,使用 绘制此函数可能会让您的生活更加轻松pgfplots
。
\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}[declare function={Gaussian(\x,\y,\z)=exp(-\z*(\x-\y)*(\x-\y));}]
\draw[very thin,color=lightgray,step=0.5cm] (0,0) grid (6.1,3.6);
\draw[->] (0,0) -- (6.2,0) node[anchor=north] {$t$};
\draw[->] (0,0) -- (0,3.7) node[anchor=east] {$v$};
\draw
(0,0) node[anchor=north] {0}
(1,0) node[anchor=north] {10}
(2,0) node[anchor=north] {20}
(3,0) node[anchor=north] {30}
(4,0) node[anchor=north] {40}
(5,0) node[anchor=north] {50}
(0,1) node[anchor=east] {5}
(0,2) node[anchor=east] {10}
(0,3) node[anchor=east] {15};
\draw[thick,color=blue] plot[domain=0:2,variable=\x,samples=101]
({\x},{3*Gaussian(\x,1,5)});
\draw[thick,color=blue] plot[domain=4:6,variable=\x,samples=101]
({\x},{3*Gaussian(\x,5,5)});
\end{tikzpicture}
\end{document}
只是为了好玩:一个快速的 pgfplots 变体。
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}[declare function={Gaussian(\x,\y,\z)=exp(-\z*(\x-\y)*(\x-\y));}]
\begin{axis}[axis lines=left,grid=major,xmin=0,xmax=72,ymin=0,ymax=22,
xlabel=$t$,ylabel=$v$]
\addplot[domain=0:20,thick,blue,samples=101] {15*Gaussian(\x,10,0.1)};
\addplot[domain=40:60,thick,blue,samples=101] {15*Gaussian(\x,50,0.1)};
\end{axis}
\end{tikzpicture}
\end{document}
您当然可以调整它的外观。