
Estoy intentando replicar el siguiente diagrama en LaTeX, pero estoy un poco perdido en la codificación. No se necesitan matemáticas. Es sólo un ejercicio para crear gráficos genéricos que se asemejan a una caída exponencial. Me gustaría replicar el etiquetado del eje y con y_0, \frac{y_0}{2} y \tau en el eje x.
Mi intento
\documentclass{amsart}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\usepackage{mathtools}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
scaled ticks=false,
xmin=0,
ymin=0,
xlabel=x,
ylabel=y ,
]
\addplot[domain=0:5, black, ultra thick,smooth] {e^(-x)};
\addplot[domain=0:0.7, gray, dashed] {0.5};
\end{axis}
\end{tikzpicture}
Respuesta1
Aquí te dejamos un ejemplo para imitar el estilo en tu figura lo más parecido posible.
\documentclass{amsart}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}
\usepackage{mathtools}
%\usepackage{tikz} %load by pgfplots
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmin=0,
xmax=2.1,
ymin=0,
ymax=1.3,
tick style={draw=none},
xtick={-ln(0.5)},
ytick={0.5,1},
xticklabels={$\tau$},
xticklabel style={font=\Large},
yticklabels={$\displaystyle\frac{y_0}{2}$,$y_0$},
yticklabel style={font=\Large},
xlabel=$t$,
ylabel=$y$,
axis lines=center,
axis line style ={thick,-latex},
x label style={anchor=west},
y label style={anchor=south}
]
\addplot[domain=0:2, black, ultra thick,smooth] {e^(-x)};
\draw [thick,dotted] (axis cs:0,0.5) -- (axis cs:{-ln(0.5)},0.5) -- (axis cs:{-ln(0.5)},0);
\end{axis}
\end{tikzpicture}
\end{document}
Respuesta2
con la bibliotecaintersection
\documentclass{amsart}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\usetikzlibrary{intersections}
\usepackage{mathtools}
% \usepackage{tikz}%<-- loaded by pgfplots
\begin{document}
\begin{tikzpicture}
\begin{axis}[
clip=false,
declare function={
f(\x)=e^(-\x);
},
scaled ticks=false,
axis lines=center,
xmin=0,
ymin=0,
xmax=5.2,
ymax=1.2,
xlabel=t,
ylabel=y,
xlabel style={
at={(1,0)},
anchor=west,
},
ylabel style={
at={(0,1)},
align=right,
anchor=south,
},
tick style={draw=none},
xtick=\empty,ytick=\empty,
]
\addplot[name path=curve,domain=0:5, black, ultra thick,smooth] {f(x)};
\path [name path=line] (axis cs:0,0.5) -- (axis cs:5,0.5);
%
\fill [red, opacity=0.5, name intersections={of=line and curve}]
(intersection-1) circle (2pt);
\draw[name intersections={of=line and curve}] [dashed](intersection-1)-|(axis cs:0,0)node[pos=0.5,xshift=-2ex,red]{$\dfrac{y_0}{2}$};
\draw[name intersections={of=line and curve}] [dashed](intersection-1)|-(axis cs:0,0)node[pos=0.5,yshift=-1ex,red]{$\tau$};
%
\node[xshift=-2ex,red]at(axis cs:0,1){$y_0$};
\end{axis}
\end{tikzpicture}
\end{document}
Respuesta3
Como esto:
Código ( tikz
):
\documentclass[margin=20pt]{standalone}
\usepackage{tikz}
%\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\draw[gray!30] (0,0) grid (6,6);
\draw[cyan,line width=2pt] plot[domain=0:6,smooth,samples=60] (\x,{6*2^(-\x)});
\draw[-latex] (0,0)--(6,0);
\draw[-latex] (0,0)--(0,6.5);
\foreach \x in {0,1,...,6}
\draw (\x,0)--(\x,-3pt) node[below] () {\small \x$\tau$};
\draw (0,6) node[left] () {$y_0$};
\draw (0,3) node[left] () {$\frac{y_0}{2}$};
\end{tikzpicture}
\end{document}
Respuesta4
Contzplot
:
\documentclass{standalone}
\usepackage{tzplot}
\begin{document}
\begin{tikzpicture}[yscale=2]
\tzaxes(3,1.3){$t$}{$y$}
\def\Fx{exp(-\x)}
\tzfn\Fx[2.5:0]{$y_0$}[l]
\tzvXpointat{Fx}{.8}(X)
\tzproj[densely dotted](X){$\tau$}{$\frac{y_0}{2}$}
\end{tikzpicture}
\end{document}