如何在 tikz 中绘制一块矩形和箭头?

如何在 tikz 中绘制一块矩形和箭头?

我正在尝试用 tikz 绘制附加的图片,但失败了。有人能帮我吗?谢谢。

最小均方误差

我所做的如下,产生了如下结果:

\documentclass[tikz,border=5]{standalone}
\renewcommand\familydefault\sfdefault
\usetikzlibrary{calc,fit,shapes.geometric}
\pgfdeclarelayer{signal}
\pgfsetlayers{signal,main}
\usetikzlibrary{chains,shapes.multipart}
\usetikzlibrary{automata,positioning}
\usetikzlibrary{arrows}% To get more arrow heads
\newcounter{cntr}
\renewcommand{\rmdefault}{ptm}
\usepackage[lite,subscriptcorrection,slantedGreek,nofontinfo]{mtpro2}
\usetikzlibrary{snakes}
\tikzstyle{printersafe}=[snake=snake,segment amplitude=0 pt]
\colorlet{sky blue}{blue!60!cyan!75!black}
\colorlet{dark blue}{blue!50!cyan}
\colorlet{chameleon}{olive!75!green}
\tikzset{signal/.style={draw=black, line width=0.2em}}


\begin{document}
    \begin{tikzpicture}[>=triangle 45,x=1em,y=1em]  
        \node[] at (-8,1) (y) {$y_n$};
        \node[] at (-8,0) (y0) {};
        \node[] at (-7,0) (y00) {};
        \node[draw,rectangle] at (0,0) (a) {MMSE $\mathbf{o}_n[1]$};
        \node[draw,rectangle] at (15,0) (b) {Decode $\mathbf{o}_n[1]$};
        \node[] at (25,0) (x) {$\hat{x}_{\mathbf{o}_n[1]}$};
        \node[] at (22,0) (x00) {};
        \draw [semithick,->] (a) -- (b);
        \draw [semithick,->] (b) -- (x);
        \draw [semithick,->] (y0) -- (a);
        \node[draw,rectangle] at (0,-5) (a1) {MMSE $\mathbf{o}_n[2]$};
        \node[draw,rectangle] at (15,-5) (b1) {Decode $\mathbf{o}_n[2]$};
        \node[] at (25,-5) (x1) {$\hat{x}_{\mathbf{o}_n[2]}$};
        \draw [semithick,->] (a1) -- (b1);
        \draw [semithick,->] (b1) -- (x1);
        \node[draw,circle] at (-5, -5) (c1) {};
        \draw [semithick,->] (c1) -- (a1);
        \draw [semithick,->] (y00) |- (c1);
        \node[] at (-5.2, -2.1) (c01) {};
        \draw [semithick] (x00) |- (c01);
        \draw [semithick, ->] (c01) |- (c1);
    \end{tikzpicture}
\end{document}

在此处输入图片描述

编辑:根据一些评论,我澄清了以下内容:我需要用箭头和圆圈重现块。类似这样的就足够了:

在此处输入图片描述

答案1

可能是这样的?我不明白代码中的标签等,因为该图应该与发布的图像完全相同,所以我忽略了这些标签并只看图像。

大多数库和定义与示例无关,所以我删除了它们。我没有非免费字体,所以我删除了它们。更改\rmdefault没有任何效果,因为它不影响数学,并且\familydefault设置为无衬线。所以我也删除了它。

\documentclass[tikz,border=5pt,multi]{standalone}
\renewcommand\familydefault\sfdefault
\usetikzlibrary{chains,scopes,arrows.meta}
\begin{document}
\begin{tikzpicture}
  [
    start chain=main going right,
    semithick,
    >={Triangle[angle=45:5pt 3]},
    pass/.style={on chain, shape=coordinate, join},
    dash pass/.style={on chain, shape=coordinate, join=by {dashed} },
    block/.style={on chain, draw, join=by {->}},
    circ/.style={on chain, draw, minimum width=5pt, circle, join=by {->}, anchor=center, label={[inner sep=0pt]135:$+$}, label={[inner sep=0pt]45:$-$}},
  ]
  {
    \node [on chain, label=above:$y_m$] {};
    \node [pass] {};
    {[start branch=first going below]
      \node [pass] {};
      \node (a) [pass] {};
      \node [dash pass] {};
    }
    \node [pass] {};
    {[start branch=third going below]
      \node (c) [shape=coordinate, on chain, label={-45:$p_{n_{m1}}h_{n_{m1}}\hat{x}_{n_{m1}}$}] {};
    }
    \node [block] {MMSE $n_{m1}$};
    \node [block] {Decode $n_{m1}$};
    \node [pass] {};
    {[start branch=second going below]
      \node (b) [pass] {};
      \chainin (c) [join];
      \node [circ] {};
      {[start branch=fourth going below]
        \node (e) [shape=coordinate, on chain, label={-45:$p_{n_{m1}}h_{n_{m1}}\hat{x}_{n_{m1}}+\dots+p_{n_{mN_{m^{-1}}}}h_{n_{mN_{m^{-1}}}}\hat{x}_{n_{mN_{m^{-1}}}}$}] {};
      }
    }
    {[continue branch=second going right]
      \node [block] {MMSE $n_{m2}$};
      \node [block] {Decode $n_{m2}$};
      \node [pass] {};
      {[start branch=third going below]
        \node (d) [dash pass] {};
        \chainin (e);
        \draw (d) -| (e);
        \node [circ] {};
        {[start branch=fifth going left]
          \node [on chain, join=by <-] {};
        }
      }
      {[continue branch=third going right]
        \node [block] {MMSE $n_{m3}$};
        \node [block] {Decode $n_{m3}$};
        \node [pass] {};
        \node [on chain, join=by ->] {$\hat{x}_{n_{m3}}$};
      }
      \node [on chain, join=by ->] {$\hat{x}_{n_{m2}}$};
    }
    \node [on chain, join=by ->] {$\hat{x}_{n_{m1}}$};
  }
\end{tikzpicture}
\end{document}

链中链

相关内容