我认为下图绘制得非常低效。我需要帮助使用节点和相对定位(right=of、below=of 等)而不是绝对定位来绘制相同的图形。
这是我的代码:
\documentclass[12pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{times}
\usepackage{tikz}
\usetikzlibrary{calc,decorations.markings,arrows,positioning,shapes}
\begin{document}
\begin{tikzpicture}[line width=1pt,>=latex',scale=0.8]
\node (d) at (-6,0) [draw,shape=rectangle,minimum width=8ex,minimum
height=5ex,align=center]{Data\\source};
\draw (-4.5,2.5) rectangle node [align=center]{Partition \\ into blocks \\ and serial\\to parallel\\conversion} (-2,-2.5);
\draw (-1,2.5) rectangle node [align=center]{Division\\into\\subblocks} (1.5,-2.5);
\draw (2.5,1.5) rectangle node {IDFT} ++(1.5,1);
\draw (2.5,0) rectangle node {IDFT} ++(1.5,1);
\draw (2.5,-2.5) rectangle node {IDFT} ++(1.5,1);
\draw [->](d) -- (-4.5,0);
\draw [->](-2,0) -- node [above]{$D$}(-1,0);
\begin{scope}\fontsize{20}{19} \selectfont
\node at (2,-0.5) {$\vdots$};
\end{scope}
%% X-Circle 1
\begin{scope}
\node at (9.5,2) [above left]{$W_1$};
\draw [->] (6.4,2) -- (9.5,2);
\draw [->] (4,2) -- ++(1.6,0);
\node at (4.5,2) [above]{$b_1$};
\draw [fill] (4.5,2) circle (1.5pt);
\draw [->](4.5,2) -- (4.5,-3);
\draw [clip] (6,2) circle (0.4cm);
\draw (5.5,2.5) -- ++(1,-1);
\draw (5.5,1.5) -- ++(1,1);
\end{scope}
%% X-Circle 2
\begin{scope}
\node at (9.5,0.5) [above left]{$W_2$};
\draw [->] (4.0,0.5) -- ++(2.6,0);
\draw [->] (7.4,0.5) -- (9.5,0.5);
\node at (5.0,0.5) [above]{$b_2$};
\draw [fill] (5.0,0.5) circle (1.5pt);
\draw [->](5.0,0.5) -- (5,-3);
\draw [clip] (7,0.5) circle (0.4cm);
\draw (6.5,1) -- ++(1,-1);
\draw (6.5,0) -- ++(1,1);
\end{scope}
%% X-Circle 3
\begin{scope}
\node at (9.5,-2) [above left]{$W_{\! M}$};
\draw [->] (4,-2) -- ++(3.6,0);
\draw [->] (8.4,-2) -- (9.5,-2);
\node at (5.5,-2) [above]{$b_M$};
\draw [fill] (5.5,-2) circle (1.5pt);
\draw [->](5.5,-2) -- (5.5,-3);
\draw [clip] (8,-2) circle (0.4cm);
\draw (7.5,-1.5) -- ++(1,-1);
\draw (7.5,-2.5) -- ++(1,1);
\end{scope}
\draw (4,-3)rectangle node{Optimization for $W$} ++(4.5,-1);
\draw [->](6,-3) -- ++(0,4.6);
\draw [->](7,-3) -- ++(0,3.1);
\draw [->](8,-3) -- ++(0,0.6);
\draw (9.5,2.5)rectangle node{$+$} ++(1,-5);
\draw [->](10.5,0)-- node [above]{$S$}(11.2,0);
\begin{scope}\fontsize{20}{19} \selectfont
\node at (7.7,-0.5) {$\vdots$};
\end{scope}
\draw [->](1.5,2) -- ++(1,0);
\draw [->](1.5,0.5) -- ++(1,0);
\draw [->](1.5,-2.0) -- ++(1,0);
\end{tikzpicture}
\end{document}
答案1
这里几乎是完全重写。由于大部分内容重复了三次,因此您可以利用 foreach 循环,每次绘制一组重复的部分。
我感到无聊,就跳过了剩下的部分,但我想你可以从那里开始
\documentclass[tikz]{standalone}
\usetikzlibrary{calc,arrows,positioning}
\begin{document}
\begin{tikzpicture}[line width=1pt,>=latex',
tall/.style={align=center,text width=2cm,minimum height=5cm},
crossed/.style={circle,draw,minimum height=8mm,outer sep=0,path picture={\draw
(path picture bounding box.south east) -- (path picture bounding box.north west)
(path picture bounding box.south west) -- (path picture bounding box.north east);
}}]
\node (d) at (-6,0) [draw,align=center]{Data\\ source};
\node[draw,tall,right= of d] (e) {Partition into blocks and serial to parallel conversion} ;
\node[draw,tall,right= of e] (f) {Division into subblocks};
\node[draw,inner xsep=5mm] (op) at (6.25,-4) {Optimization for $W$};
\draw[->] (d) -- (e) -- (f);
\foreach \x[count=\xi] in {0.1,0.4,0.9}{
\draw node[draw,inner ysep=5pt]
(idft-\xi) at ([xshift=2cm]$(f.north east)!\x!(f.south east)$) {IDFT}
node[circle,inner sep=2pt,outer sep=0,fill,right=3mm + 5*\xi mm of idft-\xi,
label={$\ifnum\xi=3b_M\else b_\xi\fi$}] (b-\xi){}
node[crossed,right=1cm+\xi cm of idft-\xi] (c-\xi){};
\draw[->] (f.east|-idft-\xi) -- (idft-\xi);
\draw[->] (b-\xi) -- (b-\xi|-op.north);
\draw[<-] (c-\xi) -- (c-\xi|-op.north);
\draw[->] (idft-\xi) --(c-\xi);
}
\end{tikzpicture}
\end{document}