我怎样才能在 LaTeX 中绘制这个函数?
编辑:我做了一些好事,但图 1 并没有按我想要的方式工作
%---------------------------FIGURE 1-------------------------------------------\begin{center}
\begin{tikzpicture}
%----------------------ASSSI---------------------
\draw[thick,->] (0,0) -- (4,0) node[anchor=north west] {tempo};
\draw[thick,->] (0,0) -- (0,4) node[anchor=south east] {velocità};
%---------------------- MOTO --------------------
\draw[smooth, domain=0:4,thick]
plot (\x,{exp(-\x)}) node [right]{};
\end{tikzpicture}
\end{center}
%----------------------------- END FIGURE 1----------------------------------------------
%----------------------------- FIGURE 2--------------------------------------------------
\begin{center}
\begin{tikzpicture}
%----------------------ASSSI---------------------
\draw[thick,->] (0.33,0) -- (4.33,0) node[anchor=north west] {tempo};
\draw[thick,->] (0.33,0) -- (0.33,4) node[anchor=south east] {posizione};
%---------------------- MOTO --------------------
\draw[smooth, domain=0.335:4,thick]
plot (\x,{3-(1/(\x))}) node [right]{};
\end{tikzpicture}
\end{center}
%----------------------------END FIGURE 2----------------------------------------------
答案1
\documentclass[varwidth,
border=3.141592]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
% ASSSI
\draw[<->] (0,4) -- node[left] {tempo} (0,0)
-- node[below] {velocità} (4,0);
% MOTO
\draw[domain=0:3.5, samples=31, thick] plot (\x,{3*exp(-\x)});
\end{tikzpicture}
\begin{tikzpicture}
% ASSSI
\draw[<->] (0,4) -- node[left] {tempo} (0,0)
-- node[below] {posizione} (4,0);
% MOTO
\draw[domain=0:3.5, samples=31, thick] plot (\x, {3-3*exp(-\x)}); % <--- corrected
\end{tikzpicture}
\end{document}