I am trying to create a diagram which looks like this:
I have tried fitting a function with increasingly many nodes, but it does not look right (showing all 3 curves on the diagram to better illustrate):
\documentclass[10pt,landscape,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[UKenglish]{babel}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture} [scale = 0.5]
\foreach \p in {-5,...,5} \node[circle,fill=green] at (\p,2*rand) (\p) {};
\draw [cyan, xshift=4cm] plot [smooth, tension=1] coordinates { (-5) (-4) (-3) (-2) (-1) (0) (1) (2) (3) (4) (5) };
\draw [red, xshift=4cm] plot [smooth, tension=1] coordinates { (-5) (-3) (-1) (1) (3) (5) };
\draw [blue, xshift=4cm] plot [smooth, tension=1] coordinates { (-5) (5) };
\end{tikzpicture}
\end{document}
I have also tried creating nodes like this (ie with a defined function x^2+x+1 + "noise" instead:
\foreach \p in {-5,...,5} \node[circle,fill=green] at (\p, \p * \p + \p + 1 + rand) (\p) {};
but that does not work at all.
In any case my code forces me to list nodes manually, which is not great.
I guess I need a way of interpolating with increasingly higher degree polynomials ? But I am not sure how to do this.




pgfplots. These are the tools you would use in a real life scenario anyway and not LaTeX for mathematical problem solving. – Dr. Manuel Kuehner Feb 27 '19 at 13:41