0

I want to plot this (based on this image from Wikipedia):

As far I get this:

\documentclass[tikz,border={20pt}]{standalone}

\usepackage{pgfplots}
\pgfplotsset{compat=1.10}
% \pgfplotsset{samples=60}

\begin{document}
\begin{tikzpicture}
\begin{axis}[view={45}{30},domain=0:4*pi,axis x line=none,axis y line=none,axis z line=none]
\addplot3[thick,blue!70,no markers,samples y=0] (x,0,{sin(pi * deg(x) / 5)});
\addplot3[thin,gray] (x,0,0);
\addplot3[thick,blue!70,no markers,samples y=0] (x,1,{1/3 * sin(3 * pi * deg(x) / 5)});
\addplot3[thin,gray] (x,1,0);
\addplot3[thick,blue!70,no markers,samples y=0] (x,2,{1/5 * sin(pi * deg(x))});
\addplot3[thin,gray] (x,2,0);
\addplot3[thick,blue!70,no markers,samples y=0] (x,3,{1/7 * sin(7 * pi * deg(x) / 5)});
\addplot3[thin,gray] (x,3,0);
\addplot3[thick,blue!70,no markers,samples y=0] (x,4,{1/9 * sin(9 * pi * deg(x) / 5)});
\addplot3[thin,gray] (x,4,0);

\addplot3[thick,red!70,no markers,samples y=0] (x,-1,{sin(pi * deg(x) / 5) + 1/3 * sin(3 * pi * deg(x) / 5) + 1/5 * sin(pi * deg(x)) + 1/7 * sin(7 * pi * deg(x) / 5) + 1/9 * sin(9 * pi * deg(x) / 5)});
\end{axis}
\end{tikzpicture}
\end{document}

So far I have next issues:

  • out of memory for larger samples;
  • how to add grey rectangles;
  • optimize code (it's really robust and straightforward now);
  • plot with lines on the left.
percusse
  • 157,807
m0nhawk
  • 9,664
  • Related? http://tex.stackexchange.com/questions/127375/replicate-the-fourier-transform-time-frequency-domains-correspondence-illustrati?rq=1 –  Aug 17 '14 at 10:14
  • 2
    My search-fu is bad, really bad... – m0nhawk Aug 17 '14 at 10:17

0 Answers0