I am trying to decay this coin wave under the exponential decay curves over time like exactly what is shown in the picture below.
I have done this code but I do not know how to fit the peaks to the curves. Here is my code:
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
trig format plots = rad,
axis lines = middle,
enlargelimits,
xlabel={$t$},
ylabel={$x$},
xlabel style={right},
ylabel style={above},
xtick=\empty,
ytick={1,0.5,-0.5,-1},
yticklabels={$A$,,,$-A$},
]
\addplot[very thick,cyan,domain=0:8*pi,samples=200] {cos(x)};
\addplot[dashed,domain=0:8*pi,samples=200] {exp(-0.2*x)};
\addplot[dashed,domain=0:8*pi,samples=200] {-exp(-0.2*x)};
\end{axis}
\end{tikzpicture}
\end{document}
Best Answer
Here is a pure TikZ solution using
sin
andcos
operators (no need to search goodsamples
value).Note: this is an approximation of the real function!