将方块分成几部分

将方块分成几部分

我基本上想分解该图右侧的 ADC 块:

在此处输入图片描述

我希望将其分成 4 个部分。这意味着它所连接的每条线路都有一个部分。每个 ADC 块都有一个 I/O。

代码如下:

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

\usetikzlibrary{chains,fit,positioning}
\begin{document}

% Version 3
\begin{tikzpicture}[
node distance = 20mm and 5mm,
  start chain = going right,
 block/.style = {draw, minimum height=20mm, minimum width=5mm,
                 font=\boldmath,on chain}]
% upper blocks
\node (ht1)   [block,draw=none]
{\hphantom{$\boldmath(H)^+$}};
\node (f1)    [block,right=6mm of ht1]     {$T^{-1}$};
\node (y1)    [block,right=39mm of ht1]     {$T$};
\node (adc1)  [block]                       {ADC};
% lower blocks
\node (ht2)   [block,draw=none,below=of ht1]
{\hphantom{$\boldmath(H)^+$}};
\node (f2)    [block,right=6mm of ht2]     {$T^{-1}$};
\node (y2)    [block,right=39mm of ht2]     {$T$};
\node (adc2)  [block]                       {ADC};
% common input nodes
\node (in2)   [draw,inner sep=0pt, fit=(ht1)  (ht2),label=center:$\boldmath H^+$] {};
% top blocks
    \node (cpu) [above=15mm of in2]     {CPU};
    \node (rf)  [above=15mm of y1]      {RF-chain};

% Math symbols
    %\node at (42mm,15mm) (g1) {$\boldmath Y_1$};

    \node (Y) at (53mm,18mm) {$\boldmath Y_1$};
    \draw [->] (Y) -- (53mm,10mm);

    \node (Y2) at (53mm,-23mm) {$\boldmath Y_k$    
};
    \draw [->] (Y2) -- (53mm,-30mm);

    \node (Z) at (41mm,6mm) {$\boldmath Z_1$};
    \node (Z2) at (41mm,-34mm) {$\boldmath Z_k$};

    \node (x) at (-12mm,11mm) {$\boldmath \hat{x}$};

\draw[densely dotted] ([xshift=29mm] cpu.north -| in2.east) coordinate (in3)
                    -- (in3 |- in2.south);
% lines between blocks
    \foreach \y in {-0.75, -0.25, 0.25, 0.75}
{
% 8 input lines
    \draw [->]  ([yshift=\y cm +2 cm] in2.west)--++(180:1cm);
    \draw [->]  ([yshift=\y cm -2 cm] in2.west)--++(180:1cm);
}
% 2 lines between other blocks
    \foreach \j in {1, 2}
{
        \foreach \y  in {-0.25, 0.25, 0.75, -0.75}
        {
            \foreach \i [remember=\i as \lasti (initially y\j)] in {adc\j}
    \draw [<-] ([yshift= \y cm ]\lasti.east)--([yshift=\y cm]\i.west);
    \draw (-1,-2.0) circle [radius=0.7pt,yshift=-0 cm -\y cm];
    \draw (3.95,-2.0) circle [radius=0.7pt,yshift=-0 cm -\y cm];
    %\draw (0,-1) -- (4,-1);
    %\draw ([yshift= 0.5 cm -\y cm] adc\j.east)--++(0:1+1.5*\y)   node[antenna] {};
    \draw ([yshift=-0 cm -\y cm] adc\j.east)--++([xshift=1.5cm] 0:1+1.5*\y)   node[antenna] {};
    }

    \foreach \y  in {-0.25, 0.25}
        {
            \foreach \i [remember=\i as \lasti (initially f\j)] in { y\j}
    \draw [<-] ([yshift= \y cm ]\lasti.east)--([yshift=\y cm]\i.west);
    }

    \foreach \y  in {-0.25, 0.25, 0.75, -0.75}
        {
            \foreach \i [remember=\i as \lasti (initially ht\j)] in { f\j}
    \draw [<-] ([yshift= \y cm ]\lasti.east)--([yshift=\y cm]\i.west);
    }
}
\end{tikzpicture}

\end{document}

也许可以直接在以下行中进行操作:

\node (adc1)  [block]      {ADC};

答案1

一个建议。我首先定义一种新样式block4,即rectangle split类型节点,即具有多个部分的矩形节点。shapes.multipart库因此加载。在adc节点中,将样式从 更改为blockblock4并将节点标签更改为ADC\nodepart{two}ADC\nodepart{three}ADC\nodepart{four}ADC

在此处输入图片描述

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

\usetikzlibrary{chains,fit,positioning,shapes.multipart}
\begin{document}

% Version 3t
\begin{tikzpicture}[
  node distance = 20mm and 5mm,
  start chain = going right,
  block/.style = {draw, minimum height=20mm, minimum width=5mm,
                 font=\boldmath,on chain},
  block4/.style={block,rectangle split,rectangle split parts=4}]
% upper blocks
\node (ht1)   [block,draw=none]
{\hphantom{$\boldmath(H)^+$}};
\node (f1)    [block,right=6mm of ht1]     {$T^{-1}$};
\node (y1)    [block,right=39mm of ht1]     {$T$};
\node (adc1)  [block4] {ADC\nodepart{two}ADC\nodepart{three}ADC\nodepart{four}ADC};
% lower blocks
\node (ht2)   [block,draw=none,below=of ht1]
{\hphantom{$\boldmath(H)^+$}};
\node (f2)    [block,right=6mm of ht2]     {$T^{-1}$};
\node (y2)    [block,right=39mm of ht2]     {$T$};
\node (adc2)  [block4] {ADC\nodepart{two}ADC\nodepart{three}ADC\nodepart{four}ADC};
% common input nodes
\node (in2)   [draw,inner sep=0pt, fit=(ht1)  (ht2),label=center:$\boldmath H^+$] {};
% top blocks
    \node (cpu) [above=15mm of in2]     {CPU};
    \node (rf)  [above=15mm of y1]      {RF-chain};

% Math symbols
    %\node at (42mm,15mm) (g1) {$\boldmath Y_1$};

    \node (Y) at (53mm,18mm) {$\boldmath Y_1$};
    \draw [->] (Y) -- (53mm,10mm);

    \node (Y2) at (53mm,-23mm) {$\boldmath Y_k$    
};
    \draw [->] (Y2) -- (53mm,-30mm);

    \node (Z) at (41mm,6mm) {$\boldmath Z_1$};
    \node (Z2) at (41mm,-34mm) {$\boldmath Z_k$};

    \node (x) at (-12mm,11mm) {$\boldmath \hat{x}$};

\draw[densely dotted] ([xshift=29mm] cpu.north -| in2.east) coordinate (in3)
                    -- (in3 |- in2.south);
% lines between blocks
    \foreach \y in {-0.75, -0.25, 0.25, 0.75}
{
% 8 input lines
    \draw [->]  ([yshift=\y cm +2 cm] in2.west)--++(180:1cm);
    \draw [->]  ([yshift=\y cm -2 cm] in2.west)--++(180:1cm);
}
% 2 lines between other blocks
    \foreach \j in {1,2}
{
        \foreach \y/\anchor  in {-0.25/two east, 0.25/three east, 0.75/four east, -0.75/text east}
        {
            \foreach \i [remember=\i as \lasti (initially y\j)] in {adc\j}
    \draw [<-] ([yshift= \y cm ]\lasti.east)--([yshift=\y cm]\i.west);
    \draw (-1,-2.0) circle [radius=0.7pt,yshift=-0 cm -\y cm];
    \draw (3.95,-2.0) circle [radius=0.7pt,yshift=-0 cm -\y cm];
    %\draw (0,-1) -- (4,-1);
    %\draw ([yshift= 0.5 cm -\y cm] adc\j.east)--++(0:1+1.5*\y)   node[antenna] {};
    \draw ([yshift=-0 cm -\y cm] adc\j.east)--++([xshift=1.5cm] 0:1+1.5*\y)   node[antenna] {};
    }

    \foreach \y  in {-0.25, 0.25}
        {
            \foreach \i [remember=\i as \lasti (initially f\j)] in { y\j}
    \draw [<-] ([yshift= \y cm ]\lasti.east)--([yshift=\y cm]\i.west);
    }

    \foreach \y  in {-0.25, 0.25, 0.75, -0.75}
        {
            \foreach \i [remember=\i as \lasti (initially ht\j)] in { f\j}
    \draw [<-] ([yshift= \y cm ]\lasti.east)--([yshift=\y cm]\i.west);
    }
}
\end{tikzpicture}
\end{document}

答案2

另一种解决方案。它保留phantomadc1 和 adc2 节点,因为它们稍后用于绘制连接。但是绘制连接时会添加一个单独的节点。

我也改变了内在foreach状态。

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

\usetikzlibrary{chains,fit,positioning}
\begin{document}

% Version 3
\begin{tikzpicture}[
node distance = 20mm and 5mm,
  start chain = going right,
 block/.style = {draw, minimum height=20mm, minimum width=5mm,
                 font=\boldmath,on chain}]
% upper blocks
\node (ht1)   [block,draw=none]
{\hphantom{$\boldmath(H)^+$}};
\node (f1)    [block,right=6mm of ht1]     {$T^{-1}$};
\node (y1)    [block,right=39mm of ht1]     {$T$};
\node (adc1)  [block, draw=none]                       {\phantom{ADC}};
% lower blocks
\node (ht2)   [block,draw=none,below=of ht1]
{\hphantom{$\boldmath(H)^+$}};
\node (f2)    [block,right=6mm of ht2]     {$T^{-1}$};
\node (y2)    [block,right=39mm of ht2]     {$T$};
\node (adc2)  [block, draw=none]                       {\phantom{ADC}};
% common input nodes
\node (in2)   [draw,inner sep=0pt, fit=(ht1)  (ht2),label=center:$\boldmath H^+$] {};
% top blocks
    \node (cpu) [above=15mm of in2]     {CPU};
    \node (rf)  [above=15mm of y1]      {RF-chain};

% Math symbols
    %\node at (42mm,15mm) (g1) {$\boldmath Y_1$};

    \node (Y) at (53mm,18mm) {$\boldmath Y_1$};
    \draw [->] (Y) -- (53mm,10mm);

    \node (Y2) at (53mm,-23mm) {$\boldmath Y_k$    
};
    \draw [->] (Y2) -- (53mm,-30mm);

    \node (Z) at (41mm,6mm) {$\boldmath Z_1$};
    \node (Z2) at (41mm,-34mm) {$\boldmath Z_k$};

    \node (x) at (-12mm,11mm) {$\boldmath \hat{x}$};

\draw[densely dotted] ([xshift=29mm] cpu.north -| in2.east) coordinate (in3)
                    -- (in3 |- in2.south);
% lines between blocks
    \foreach \y in {-0.75, -0.25, 0.25, 0.75}
{
% 8 input lines
    \draw [->]  ([yshift=\y cm +2 cm] in2.west)--++(180:1cm);
    \draw [->]  ([yshift=\y cm -2 cm] in2.west)--++(180:1cm);
}
% 2 lines between other blocks
    \foreach \j in {1, 2}
{
        \foreach \y  in {-0.25, 0.25, 0.75, -0.75}
        {
            \foreach \i  in {adc\j}
    \draw [<-] ([yshift= \y cm ]y\j.east)--([yshift=\y cm]\i.west) node[draw, minimum height=3.5mm, anchor=west]{ADC};
    \draw (-1,-2.0) circle [radius=0.7pt,yshift=-0 cm -\y cm];
    \draw (3.95,-2.0) circle [radius=0.7pt,yshift=-0 cm -\y cm];
    %\draw (0,-1) -- (4,-1);
    %\draw ([yshift= 0.5 cm -\y cm] adc\j.east)--++(0:1+1.5*\y)   node[antenna] {};
    \draw ([yshift=-0 cm -\y cm] adc\j.east) --++([xshift=1.5cm] 0:1+1.5*\y)   node[antenna] {};
    }

    \foreach \y  in {-0.25, 0.25}
        {
            \foreach \i [remember=\i as \lasti (initially f\j)] in { y\j}
    \draw [<-] ([yshift= \y cm ]\lasti.east)--([yshift=\y cm]\i.west);
    }

    \foreach \y  in {-0.25, 0.25, 0.75, -0.75}
        {
            \foreach \i [remember=\i as \lasti (initially ht\j)] in { f\j}
    \draw [<-] ([yshift= \y cm ]\lasti.east)--([yshift=\y cm]\i.west);
    }
}
\end{tikzpicture}

\end{document}

一个细节:

在此处输入图片描述

相关内容