9

I would like to recreate this image: enter image description here

I would like to use pgfplots with math functions so that the waves are mathematically generated. Here is what I got so far:

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[domain=-5:5, samples=250,no markers, hide axis,y=1cm,thick]
\addplot {0.3*cos(2*deg(x))}node[right]{$\lambda=1Hz$};
\addplot {0.3*cos(4*deg(x))+1}node[right]{$\lambda=2Hz$};
\addplot {0.3*cos(8*deg(x))+2}node[right]{$\lambda=4Hz$};
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

Ideas are welcome.

8

You could just add some random noise.

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\begin{document}
\begin{tikzpicture}[declare function={a1=0.6;a2=0.3;a3=0.4;}]
\begin{axis}[domain=-5:5, samples=75,no markers, hide axis,y=1cm,thick,
    trig format plots=rad,smooth,clip=false]
\addplot[samples=51] {0.3*cos(2*x)*(1+a1*rand)}node[right]{$\lambda=1\,$Hz};
\addplot {0.3*cos(4*x)*(1+a2*rand)+1}node[right]{$\lambda=2\,$Hz};
\addplot {0.3*cos(8*x)*(1+a3*rand)+2}node[right]{$\lambda=4\,$Hz};
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here

| improve this answer | |
  • Noise is a nice addition (with a fixed seed). Nevertheless, I think an alpha wave is a composite of waves in the alpha frequency band (between 8 and 12Hz). – Pedro Jun 4 at 19:08
  • 6
    @Pedro Sure, you could add a Fourier sum. But I would not think that this will be a truly accurate modeling of an EEG. (It would be shocking if our brain could get modeled but just a few Fourier terms. ;-) So maybe random isn't too bad. I agree on the the \pgfmathsetseed part, though. Maybe one can make the Fourier coefficients random. – user194703 Jun 4 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.