答案1
这是一种非常手动的方式,通过手动放置所有东西来完成。
\documentclass[tikz, border=20]{standalone}
\colorlet{myGreen}{green!50!black}
\begin{document}
\begin{tikzpicture}
\draw[<->,>=latex] (0, 4.2) -- (0, 0) -- (4.2, 0);
\draw[ultra thick, myGreen] (0, 0) -- (1.8, 0);
\draw[ultra thick, myGreen] (2.2, 0) -- (4, 0);
\draw[ultra thick, myGreen] (1.8, 3.5) -- (2.2, 3.5);
\draw[dashed, myGreen] (1.8, 0) -- (1.8, 3.5);
\draw[dashed, myGreen] (2.2, 0) -- (2.2, 3.5);
\draw[ultra thick, dashed, orange] (0, 0) -- (4, 0);
\node[right, myGreen] at (2.2, 3.5) {\(u_2(t)\)};
\node[above, orange] at (3.8, 0) {\(u_2^*(t)\)};
\draw (-0.2, 3.5) -- (0.2, 3.5);
\node[right] at (0.2, 3.5) {\(\alpha\)};
\node[below left] at (2, 0) {\(\bar{t} - \varepsilon\)};
\node[below] at (2.2, 0) {\(\bar{t}\)};
\end{tikzpicture}
\end{document}