如何将天线添加到流程图中

如何将天线添加到流程图中

我想在框图(右端)中添加 4 个天线。我尝试使用 \node (9,0) node[antenna],但没有成功。我的代码如下:

\documentclass[a4]{report}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc} % Use this if the file is encoded with utf-8
\usepackage{times}
\usepackage[T1]{fontenc}
\usepackage{tikz} % Create graphics in Latex
\usetikzlibrary{graphs}
\usetikzlibrary{calc}

\usepackage{circuitikz}
\usetikzlibrary{positioning}
\usetikzlibrary{shapes,arrows}

\begin{document}

\thispagestyle{empty}

%\usetikzlibrary{positioning}

\begin{tikzpicture}
  \node at (0,0) [draw, rectangle, minimum height=2cm, minimum width=.5cm] (mynode) {$\textit{\textbf{\^{x}}}$};
  \foreach \y in {-0.25, -0.75, 0.25, 0.75}{
    \draw [black, -] (-1,\y) -- ($(mynode.west) +(0,\y)$);
  }

    \node at (2,0) [draw, rectangle, minimum height=2cm, minimum width=.5cm] (mynode) {$\textit{\textbf{(HT})}^{+}$};
  \foreach \y in {-0.25, -0.75, 0.25, 0.75}{
    \draw [black, -] (0.25,\y) -- ($(mynode.west) +(0,\y)$);
  }

  % ... more lines
      \node at (4,0) [draw, rectangle, minimum height=2cm, minimum width=.5cm] (mynode) {$\textit{\textbf{T}}$};
  \foreach \y in {-0.25, -0.75, 0.25, 0.75}{
    \draw [black, -] (2.75,\y) -- ($(mynode.west) +(0,\y)$);
  }

  % ... more lines
      \node at (6,0) [draw, rectangle, minimum height=2cm, minimum width=.5cm] (mynode) {$\textit{\textbf{Y}}$};
  \foreach \y in {-0.25, -0.75, 0.25, 0.75}{
    \draw [black, -] (4.25,\y) -- ($(mynode.west) +(0,\y)$);
  }

      %\node (9,0) node[antenna]
      \node at (8,0) [draw, rectangle, minimum height=2cm, minimum width=.5cm] (mynode) {ADC};

  \foreach \y in {-0.25, -0.75, 0.25, 0.75}{
    \draw [black, -] (6.25,\y) -- ($(mynode.west) +(0,\y)$);
    \draw [black, -] (9.5,\y) -- ($(mynode.east) +(0,\y)$)
     }
  \end{tikzpicture}\\\\

\end{document}

答案1

我对你的代码做了一些修改,但结果还是类似的。

首先,所有块都绘制了,每个块都有不同的名称。这样你以后就可以使用这个名称。如果你总是使用,mynode就无法区分不同的节点。

并且由于我们有不同的名称,所以foreach循环可以帮助我们绘制节点之间的所有链接。

最后,在图表的右端画出四根天线。

\documentclass[tikz,border=2mm]{standalone}

\usepackage{tikz} % Create graphics in Latex
\usepackage{circuitikz}

\begin{document}

\begin{tikzpicture}[block/.style={draw, minimum height=2cm, minimum width=5mm}]

  \node[block, font=\boldmath] at (0,0) (x) {$\hat{x}$};
  \node[block, font=\boldmath] at (2,0) (ht) {$(HT)^+$};
  \node[block, font=\boldmath] at (4,0) (t) {$T$};
  \node[block, font=\boldmath] at (6,0) (y) {$Y$};
  \node[block, font=\bfseries] at (8,0) (adc) {ADC};
  \foreach \y in {-0.25, -0.75, 0.25, 0.75}{
    \draw [black, -] ([yshift=\y cm]x.west)--++(180:1cm);
    \foreach \i [remember=\i as \lasti (initially x)] in {ht,t,y,adc}
        \draw [black, -] ([yshift=\y cm]\lasti.east)--([yshift=\y cm]\i.west);
  }

  \draw[black, -] ([yshift=0.75cm]adc.east)--++(0:.5cm) node[antenna] {};
  \draw[black, -] ([yshift=0.25cm]adc.east)--++(0:1.25cm) node[antenna] {};
  \draw[black, -] ([yshift=-0.25cm]adc.east)--++(0:2cm) node[antenna] {};
  \draw[black, -] ([yshift=-0.75cm]adc.east)--++(0:2.75cm) node[antenna] {};

  \end{tikzpicture}

\end{document}

在此处输入图片描述

更新:How do I take away the two outermost lines between the (HT)^+ box and the T box?

如果我正确理解了你的问题,一个可能的选择是改变并采取和foreach之间的链接的特殊情况。htt

\documentclass[tikz,border=2mm]{standalone}

\usepackage{tikz} % Create graphics in Latex
\usepackage{circuitikz}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}[block/.style={draw, minimum height=2cm, minimum width=5mm}]

  \node[block, font=\boldmath] at (0,0) (x) {$\hat{x}$};
  \node[block, font=\boldmath] at (2,0) (ht) {$(HT)^+$};
  \node[block, font=\boldmath] at (4,0) (t) {$T$};
  \node[block, font=\boldmath] at (6,0) (y) {$Y$};
  \node[block, font=\bfseries] at (8,0) (adc) {ADC};
  \foreach \y in {-0.75, -0.25, 0.25, 0.75}{
    \draw ([yshift=\y cm]x.west)--++(180:1cm);
     \foreach \i/\j in {x/ht,t/y,y/adc}
        \draw ([yshift=\y cm]\i.east)--([yshift=\y cm]\j.west);
  }

  \foreach \y in {-0.25, 0.25}{
        \draw ([yshift=\y cm]ht.east)--([yshift=\y cm]t.west);
  }

  \draw[black, -] ([yshift=0.75cm]adc.east)--++(0:.5cm) node[antenna] {};
  \draw[black, -] ([yshift=0.25cm]adc.east)--++(0:1.25cm) node[antenna] {};
  \draw[black, -] ([yshift=-0.25cm]adc.east)--++(0:2cm) node[antenna] {};
  \draw[black, -] ([yshift=-0.75cm]adc.east)--++(0:2.75cm) node[antenna] {};

  \end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容