# how to obtain a loop of wave

\documentclass[12pt]{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{axis}[hide axis,red,width=16cm,height=8cm,thick]
},
ultra thick, point meta=x*x,mesh]{sin(150*pow(x,1/2))};
%You could also ask a new question. Or you could just flip the picture.
\begin{tikzpicture}[xscale=-1]
\begin{axis}[hide axis,red,width=16cm,height=4cm,thick]
ultra thick, point meta=x*x,mesh]
{sin(pow(x,2)/15)};
\end{axis}
\end{tikzpicture}
\end{document}


This code work well for me. But I would obtain just one more thing: - How can I obtain a more hight wave the more waves are tracked? I would increase also distance between waves

• For those who are wondering: the code comes from this answer and the comments below. ;-) – user121799 Dec 13 '18 at 9:51
• Could you please try to reword a bit? You want to increase the amplitude, right? And the overall wave length? And what else? – user121799 Dec 13 '18 at 9:52
• yes that's right. but I would that this occur on the way that wave are tracked: I mean: the first wave will have amplitude and wave lenght = 1; the second =2 third = 3 and so on – RenatoP Dec 13 '18 at 10:05

Your code does not compile, unfortunately, since you have unmatched \begin{tikzpicture} and \begin{axis} environments. Here is my answer as far as I understand the question. It is based on this answer and the parametrization of the last example is borrowed from this answer. This shows how one may flip the direction and increase the amplitude. If you want to change the number of oscillations, you could change the domain.

\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\subsubsection*{Changing the function}
\begin{tikzpicture}
\begin{axis}[hide axis,red,width=16cm,height=6cm,thick]
colormap={}{ color(2cm)=(blue);
color(16cm)=(red);
},
ultra thick, point meta=x*x,mesh]{sin(150*pow(x,1/2))};
\end{axis}
\end{tikzpicture}
\subsubsection*{Flipping the direction}
\begin{tikzpicture}[xscale=-1]
\begin{axis}[hide axis,red,width=16cm,height=6cm,thick]
colormap={}{  color(2cm)=(red);
color(16cm)=(blue);
},
ultra thick, point meta=x*x,mesh]{sin(pow(x,2)/15)};
\end{axis}
\end{tikzpicture}

\subsubsection*{Modulating the amplitude}
\begin{tikzpicture}[xscale=-1]
\begin{axis}[hide axis,red,width=16cm,height=6cm,thick]
colormap={}{  color(2cm)=(red);
color(16cm)=(blue);
},
ultra thick, point meta=x*x,mesh]{sin(pow(x,2)/15)/(x/20)};
\end{axis}
\end{tikzpicture}

\subsubsection*{Modulating the amplitude and the wave length}
\begin{tikzpicture}[xscale=-1,declare function={% parametrization based on https://tex.stackexchange.com/a/405058/121799
amplitude(\x)=pow(\x,-1/2)*sin(exp(ln(\fmin)+\x/\xmax*(ln(\fmax)-ln(\fmin)))*\x);}]
\pgfmathsetmacro{\xmin}{20}
\pgfmathsetmacro{\xmax}{240}
\pgfmathsetmacro{\fmin}{(pi/3)}
\pgfmathsetmacro{\fmax}{(2*pi)}
\begin{axis}[hide axis,red,width=16cm,height=6cm,thick]
colormap={}{  color(2cm)=(red);
color(16cm)=(blue);
},
ultra thick, point meta=x*x,mesh]{amplitude(x)};
\end{axis}
\end{tikzpicture}

\end{document}


• marmott, can you made modification on the original code ojf javi_gg1? I would obtain a fine tuning of the wave... – RenatoP Dec 14 '18 at 11:11
• @RenatoP If you tell me what, you want, I will be happy to try. Here you asked another question. Do you want to have an exponentially growing wave? – user121799 Dec 15 '18 at 1:34
• Hi marmot, thank you for your patience. The prob is 1 - what I want 2 - how difficult is to explain in in English. I try: I would have a frequency wave (like the one that Javi_gg1 show) but: 1 - inverted (before hight frequency, very hight frequency, then low frequency. The most similar is your III example) 2 - if possible with the same code of Javi (I mean not a functionalists, but a trigonometric function. I will tell you why) 3 - if possible, when the wavelength increases, it increases also the interval between them (but I think is natural that) Is it possible? – RenatoP Dec 16 '18 at 10:25
• @RenatoP I added something... – user121799 Dec 16 '18 at 14:33
• what do you mean? – RenatoP Dec 16 '18 at 14:51