TeX - LaTeX Asked on January 16, 2021
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 ?
For your first question, you forgot a parenthesis. Your code is
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=cosomega_2x$};
node[color=green!60!black] at (5,2) [left] {$y=cosomega_1x$};
% Change y as you need, it's the distance between the two plots
defy{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=cosomega_1x+cosomega_2x$};
end{scope}
end{tikzpicture}
end{document}
Answered by Juan Castaño on January 16, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP