答案1
请注意,您必须从某个点 >0 开始,因为 exp(-1/x) 在 x=0 时未定义。
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[axis lines=center,domain=-1:1.75,xlabel={$t$},
ymin=-.1,% to prevent line getting cropped at y=0
height=4cm,width=8cm]
\addplot[samples=2,dashed] {1};
\addplot[domain=-1:0.001,samples=2,color=black,ultra thick] {0};
\addplot[domain=0.001:1.5,samples=50,color=black,ultra thick] {exp(-1/x};
\end{axis}
\end{tikzpicture}%
\end{document}