答案1
欢迎来到 TeX.SE!!!
您只需修复域、比例或函数定义。例如,删除比例因子并将其应用于函数 y 变量,并更改域:
\documentclass[border=2mm,tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[->] (-1, 0) -- (5, 0) node[right] {$t$};
\draw[->] (0, -1) -- (0, 2) node[above] {$S(t)$};
\draw[domain=0:4, smooth, blue] plot (\x, {-0.5*(\x - 2) ^ 2 + 1.5});
\node at ({2-sqrt(3)},0) [below right] {$\bar t$};
\node at ({2+sqrt(3)},0) [below left] {$t^b$};
\draw[dashed] (2,1.5) -- (2,0) node [below] {$t^a$}; % <-- I can't see the original label
\end{tikzpicture}
\end{document}
然而,原始函数对我来说更像是双曲线。如果是这样的话:
\documentclass[border=2mm,tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[->] (-1, 0) -- (5, 0) node[right] {$t$};
\draw[->] (0, -1) -- (0, 2) node[above] {$S(t)$};
\draw[domain=0:4, smooth, blue] plot (\x, {2-sqrt(1+(\x-2) ^2});
\node at ({2-sqrt(3)},0) [below right] {$\bar t$};
\node at ({2+sqrt(3)},0) [below left] {$t^b$};
\draw[dashed] (2,1) -- (2,0) node [below] {$t^a$}; % <-- I can't see the original label
\end{tikzpicture}
\end{document}
答案2
也许是这样的:
\documentclass{article}
\usepackage{tikz}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}[scale=2]
\draw[->] (-.5, 0) -- (4.5, 0) node[right] {$t$};
\draw[->] (0, -1.5) -- (0, 3.5) node[above] {$S(t)$};
\draw[dashed] (2,0)--(2,3);
\draw[domain=0:4, smooth, variable=\x, blue] plot ({\x}, {-(\x-2)^2+3});
\end{tikzpicture}
\end{document}
就是你想要的。它会给你这个: