关注这里的问题绘制简单的正弦波 在帮助下,我能够绘制右侧图片。如何绘制左侧图片并将其组合起来?
下面是上一个问题中的简单正弦波。
\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}[font=\sffamily,
declare function={f1(\x)=1.2*sin(2.5*deg(\x));
f2(\x)=0.6*(1.2*sin(2*deg(\x))+1*sin(4*deg(\x))+1.2*sin(6*deg(\x)));
}]
\begin{scope}[yshift=-6cm,local bounding box=B]
\draw[latex-latex](0,3) node[above]{Amplitude} |- (10,0);
\draw plot[domain=0:9,variable=\x,samples=101,smooth] ({\x},{f2(\x)});
\end{scope}
%
\path foreach \X in {B} {(\X.south) node[below] {Time}};
\end{tikzpicture}
\end{document}
答案1
circutikz
请注意,如果您想制作更多电路,用 重新制作左侧部分可能很有意义,但您可以像下面的示例一样使用它。我碰巧对此不太熟练,所以我只使用了一些基本的and
门。主要问题似乎是如何水平排列事物。答案是:就像您链接到的答案一样,但使用xshift
而不是yshift
。
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{circuits,circuits.logic.US,matrix,positioning,shapes.geometric}
\begin{document}
\begin{tikzpicture}[font=\sffamily,circuit logic US,
/pgf/logic gate input sep=2ex,
declare function={f2(\x)=0.6*(1.2*sin(2*deg(\x))+1*sin(4*deg(\x))+1.2*sin(6*deg(\x)));
}]
\begin{scope}[local bounding box=L]
\matrix[matrix of nodes,nodes={and gate},nodes in empty cells] (mat){
\\[2em]
\\[4em]
\\
};
\node[right=5em of mat,ellipse,draw,thick] (Sigma) {$\Sigma$};
\foreach \X in {1,2,3}
{\draw ([yshift=0.75ex]mat-\X-1.input 1) -- ++ (-2em,0) node[left]{$\ifnum\X=3
\mathsf{Amp}_N(t)\else \mathsf{Amp}_\X(t)\fi$};
\draw ([yshift=-0.75ex]mat-\X-1.input 2) -- ++ (-2em,0) node[left]{$\ifnum\X=3
\mathsf{Freq}_N(t)\else \mathsf{Freq}_\X(t)\fi$};
\draw[thick,-latex] (mat-\X-1.output) -- (Sigma);
}% https://tex.stackexchange.com/a/52856/194703
\draw[dash pattern=on .05mm off 4mm,line cap=round,line width = 2mm,
shorten <=3mm] (mat-2-1.south) -- (mat-3-1.north);
\end{scope}
%
\begin{scope}[xshift=6cm,local bounding box=R]
\draw[latex-latex](0,3) node[above]{Amplitude} |- (10,0);
\draw plot[domain=0:9,variable=\x,samples=101,smooth] ({\x},{f2(\x)});
\end{scope}
%
\path (R.south) node[below] {Time};
\draw[thick,-latex] (Sigma) -- (Sigma-|R.west);
\end{tikzpicture}
\end{document}
请咨询js bibra 提供的链接以获得更多选项。