I need help to replicate the following figure in TikZ, which schematically describes the difference between (a) a transverse and (b) a longitudinal wave travelling through a spring. I tried finding a mathematical function to describe the vibrating spring, which is quite simple in the transverse case but I can't find a suitable function for the longitudinal one. Any clues? May be it's better to use pathmorphing?
Thanks in advance! Regards.
Here's the code I'm working with, as a MWE:
\documentclass{article}
\usepackage{tikz,pgfplots,pgf,pgfplotstable}
\usetikzlibrary{arrows,positioning,calc}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}[scale=0.9]
\begin{scope}[shift={(0,0)}]
\begin{axis}[
xscale=1.2,
yscale=0.8,
xmin=-1,
xmax=11,
ymin=-2,
ymax=2.2,
xlabel=$x$,
ylabel=$f$,
xmajorticks=false,
ymajorticks=false,
axis y line=middle,
axis x line=middle,
x label style={at={(axis description cs:0.875,0.595)},anchor=east},
y label style={at={(axis description cs:0.08,1.4)},anchor=north},
no markers,
every axis plot/.append style={thick}
]
\addplot[blue,thick,samples=400,domain=0:10.5] (\x,
{1.2*sin(deg(x))+0.3*sin(20*deg(x))});
\draw[latex-latex,line width=3pt,purple] (-0.5,-0.8) -- (-0.5,0.8);
\draw[densely dashed] (1.57,1.5) -- (1.57,2);
\draw[densely dashed] (7.85,1.5) -- (7.85,2);
\draw[latex-latex] (1.57,1.8) -- (7.85,1.8) node[midway,above] {$\lambda$};
\draw[-latex,thick] (1.07,-0.75) -- (2.07,-0.75) node[midway,above] {$v$};
\end{axis}
\node at (-0.5,5) {(a)};
\end{scope}
\begin{scope}[shift={(0,-5.5)}]
% the second graph here
\end{scope}
\end{tikzpicture}
\end{document}

