我之前问过一个关于同样问题的问题。我想对代码进行一些修改,但编译器崩溃了。基本上我想从代码中删除块 x,我已经从代码中删除了 T。
我想要的效果如下:https://i.stack.imgur.com/nKzc5.jpg
之前的样子如下:https://i.stack.imgur.com/0Dn6A.png
代码如下:
\documentclass[tikz,border=2mm]{standalone}
\usepackage{circuitikz}
\usetikzlibrary{fit,positioning}
\begin{document}
\begin{tikzpicture}[
node distance = 22mm and 5mm,
block/.style={draw, minimum height=20mm, minimum width=5mm,
font=\boldmath}]
\node (x1) [block,draw=none] {};
\node (ht1) [block,draw=none,right=of x1] {\hphantom{$\boldmath(HT)^+$}};
%\node (t1) [block,right=22mm of ht1] {$T_{1}$};
\node (y1) [block,right=22mm of ht1] {$Y_{1}$};
\node (adc1) [block,right=of y1] {ADC};
\foreach \y in {-0.75, -0.25, 0.25, 0.75}
{
\draw ([yshift=\y cm]x1.west)--++(180:1cm);
\foreach \i [remember=\i as \lasti (initially ht1)] in {x1,ht1,y1,adc1}
\draw [black, -] ([yshift=\y cm]\lasti.east)--([yshift=\y cm]\i.west);
\draw ([yshift=1-\y cm] adc1.east)--++(0:2+1.5*\y) node[antenna] {};
}
\draw[densely dotted] (3.75,2) -- (3.75,-7);
\node[draw] at (2,2) {CPU};
\node[draw] at (6,2) {RF-chain};
\node (x2) [block,draw=none,below=of x1] {};
\node (ht2) [block,draw=none,right=of x2] %right=of x2 {\hphantom{$\boldmath(TH)^+$}};
%\node (t2) [block,right=22mm of ht2] {$T_{2}$};
\node (y2) [block,right=22mm of ht2] {$Y_{2}$};
\node (adc2) [block,right=of y2] {ADC};
\foreach \y in {-0.25, -0.75, 0.25, 0.75}
{
\draw ([yshift=\y cm]x2.west)--++(180:1cm);
\foreach \i [remember=\i as \lasti (initially ht2)] in {x2,ht2,y2,adc2}
\draw [black, -] ([yshift=\y cm]\lasti.east)--([yshift=\y cm]\i.west);
\draw ([yshift=1-\y cm] adc2.east)--++(0:2+1.5*\y) node[antenna] {};
}
\node[draw,inner sep=0pt, fit= (x1) (x2), label=center:$\boldmath\hat{x}$] {};
\node[draw,inner sep=0pt, fit=(ht1) (ht2),label=center:$\boldmath(TH)^+$] {};
\end{tikzpicture}
\end{document}
答案1
看看,如果我理解正确的话:
\documentclass[tikz,border=2mm]{standalone}
\usepackage{circuitikz}
\usetikzlibrary{chains,fit,positioning}
\begin{document}
\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(HT)^+$}};
\node (y1) [block,right=22mm of ht1] {$Y$};
\node (adc1) [block] {ADC};
% lower blocks
\node (ht2) [block,draw=none,below=of ht1] {\hphantom{$\boldmath(HT)^+$}};
\node (y2) [block,right=22mm of ht2] {$Y$};
\node (adc2) [block] {ADC};
% common input nodes
\node (in2) [draw,inner sep=0pt, fit=(ht1) (ht2),label=center:$\boldmath(HT)^+$] {};
% top blocks
\node (cpu) [above=5mm of in2] {CPU};
\node (rf) [above=5mm of y1] {RF-chain};
\draw[densely dotted] ([xshift=11mm] 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 +1 cm] in2.west)--++(180:1cm);
\draw ([yshift=\y cm -1 cm] in2.west)--++(180:1cm);
% 4 lines + antennas
\foreach \j in {1, 2}
{
\draw ([yshift=\y cm] y\j.east)--([yshift=\y cm] adc\j.west);
\draw ([yshift=\y cm] adc\j.east)--++(0:2-1.5*\y) node[antenna] {};
}
}
% 2 lines between other blocks
\foreach \j in {1, 2}
\draw ([yshift=+5mm] y\j.west)-- ([yshift=+5mm] in2.east |- y\j.west)
([yshift=-5mm] y\j.west)-- ([yshift=-5mm] in2.east |- y\j.west);
\end{tikzpicture}
\end{document}
在删除某个节点时(从我的答案的第三个版本开始,您还需要删除/更改所有带有其名称的锚点(例如,在绘制线条时)。