6

I want to align vertically several random signal waveforms, as depicted in this post.

However, it seems that the given answer is not adapted in my case, since I can only draw two curves as showed by the following MWE:

\documentclass[xcolor={dvipsnames,svgnames,table}, 8pt]{beamer}
\usepackage{tikz}
\begin{document}
\frame{
    \frametitle{Test}
    \begin{columns}
    \begin{column}{.3\textwidth}
    \centering
    \begin{tikzpicture}[
    declare function={
      excitation(\t,\w) = sin(\t*\w);
      noise = rnd - 0.5;
      source(\t) = excitation(\t,20) + noise;
      filter(\t) = 1 - abs(sin(mod(\t, 50)));
      speech(\t) = 1 + source(\t)*filter(\t);
    }
  ]
    \draw[orange, thick, x=0.0085cm, y=.5cm] (0,1) -- plot [domain=0:360, samples=144, smooth] (\x,{speech(\x)});
    \node[align=center] { \\[1cm]$\vdots$\\[1cm]};
    \draw[orange, thick, x=0.0085cm, y=-0.5cm] (0,1) -- plot [domain=0:360, samples=144, smooth] (\x,{speech(\x)});
     \end{tikzpicture}
    \end{column}
    \end{columns}
}
\end{document}

enter image description here

How can I align vertically, let's say 3 signal waveforms (with vertical dots between the second and the third one)?

8

alternatively, slightly simplified and shorter code:

\documentclass[xcolor={dvipsnames,svgnames,table}]{beamer}
\usepackage{tikz}

\begin{document}
\begin{frame}
\frametitle{Speech signal}
    \frametitle{Test}
    \begin{columns}
    \begin{column}{.3\textwidth}
    \centering
    \begin{tikzpicture}[
    x=0.0085cm, y=0.5cm,
    declare function={
      excitation(\t,\w) = sin(\t*\w);
      noise = rnd - 0.5;
      source(\t) = excitation(\t,20) + noise;
      filter(\t) = 1 - abs(sin(mod(\t, 50)));
      speech(\t) = 1 + source(\t)*filter(\t);
                    },
    orange, thick, smooth,          % <--- moved here
    domain=0:360, samples=144,      % <--- moved here
  ]
    \draw plot (\x,{6+speech(\x)}); % <---
    \draw plot (\x,{3+speech(\x)}); % <---
    \draw plot (\x,{0+speech(\x)}); % <---
    %
    \draw[black, densely dotted, very thick]   (0,2.2) -- (0,2.8)
                                        (0,5.2) -- (0,5.8);
     \end{tikzpicture}
    \end{column}
    \begin{column}{.7\textwidth}
    content of the second column
    \end{column}
    \end{columns}
\end{frame}
\end{document}

enter image description here

|improve this answer|||||
6

You could use the yshift option to vertically shift the graphs.

\documentclass[xcolor={dvipsnames,svgnames,table}, 8pt]{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}
    \frametitle{Test}
    \begin{columns}
    \begin{column}{.3\textwidth}
    \centering
    \begin{tikzpicture}[
    declare function={
      excitation(\t,\w) = sin(\t*\w);
      noise = rnd - 0.5;
      source(\t) = excitation(\t,20) + noise;
      filter(\t) = 1 - abs(sin(mod(\t, 50)));
      speech(\t) = 1 + source(\t)*filter(\t);
    }
  ]
    \draw[orange, thick, x=0.0085cm, y=.5cm] (0,1) -- plot [domain=0:360, samples=144, smooth] (\x,{speech(\x)});
    \draw[densely dotted, thick] (0,1.2) -- (0,1.7);
    \draw[orange, thick, x=0.0085cm, y=.5cm,yshift=1.3cm] (0,1) -- plot [domain=0:360, samples=144, smooth] (\x,{speech(\x)});
    \draw[densely dotted, thick] (0,2.5) -- (0,3.0);
    \draw[orange, thick, x=0.0085cm, y=.5cm,yshift=2.6cm] (0,1) -- plot [domain=0:360, samples=144, smooth] (\x,{speech(\x)});
     \end{tikzpicture}
    \end{column}
    \end{columns}
\end{frame}
\end{document}

enter image description here

|improve this answer|||||

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.