# Display of the sum of two sinusoids

I would like to set up the beat principle: the sum S of two sinusoidal signals (S1 and S2) of close frequency presents a modification of amplitude. I managed to figure out the 2 sinusoidal signals on the other hand when I want to see the sum, it does not correspond to what I expect.

\documentclass{article}

\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetikzlibrary{babel}

\begin{document}

\begin{center}
\begin{tikzpicture}[samples=1000]
\draw[->] (-5,0) -- (5.2,0) node[right] {$t$};
\draw[->] (-5,-2) -- (-5,2) node[above] {$S$};

\draw[color=blue] plot ({\x},{cos(10*\x r)});
\draw[color=green!60!black] plot ({\x},{cos(9.25*\x r)});
\draw plot ({\x},{cos(10*\x+cos(9.25*\x r)});
\end{tikzpicture}
\end{center}

\end{document}


In addition, I would like to be able to have 2 graphs one and the other superimposed: the first with the 2 signals (S1 and S2), the other below with the sum S

Could you help me ?

• Can't check now, but remember that angles are in degree by default in TikZ. Anyway, pgfplots is in my opinion the correct tool for this task... Dec 31, 2020 at 9:22

\draw plot ({\x},{cos(10*\x+cos(9.25*\x r)});


and it should be

\draw plot ({\x},{cos(10*\x r)+cos(9.25*\x r)});


For the second question, a simple way to do it could be the following:

\documentclass{standalone}
\usepackage   {tikz}

\begin{document}
\begin{tikzpicture}[samples=1000]
\draw[->] (-5,0)  -- (5.2,0) node[right] {$t$};
\draw[->] (-5,-2) -- (-5,2)  node[above] {$S$};
\draw[color=blue] plot ({\x},{cos(10*\x r)});
\draw[color=green!60!black] plot ({\x},{cos(9.25*\x r)});
\node[color=blue]           at (5,1.5) [left] {$y=\cos\omega_2x$};
\node[color=green!60!black] at (5,2)   [left] {$y=\cos\omega_1x$};
% Change \y as you need, it's the distance between the two plots
\def\y{5}
\begin{scope}[shift={(0,-\y)}]
\draw[->] (-5,0)  -- (5.2,0) node[right] {$t$};
\draw[->] (-5,-2) -- (-5,2)  node[above] {$S$};
\draw plot ({\x},{cos(10*\x r)+cos(9.25*\x r)});
\node at (5,2) [left] {$y=\cos\omega_1x+\cos\omega_2x$};
\end{scope}
\end{tikzpicture}
\end{document}


And finally, this is what I get: • Nice ! Shouldn't we see a separation on the y axis with an arrow corresponding to the top of the axis of the bottom figure? Dec 31, 2020 at 11:19
• You are right. I'm going to do an edit and change that. Dec 31, 2020 at 11:40