带宽分割的TikZ代码:显示问题
TikZ code for bandwidth segmentation: display problem
我想以图形方式说明带宽分段器。为此,我想在 TikZ
中表示下图
到目前为止,我有以下 LaTeX 代码
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,calc}
\usepackage{amsmath, amssymb, mathtools}
\usepackage{physics}
\newcounter{cnt}\setcounter{cnt}{0}
\begin{document}
\tikzset{str_to_vec/.style = {rectangle, draw, minimum width=3cm, text centered}}
\tikzset{modulus2/.style = {rectangle, draw, text centered}}
\tikzset{thresh/.style = {rectangle, draw, text centered}}
\tikzset{dottedline/.style = {ultra thick, loosely dotted,shorten >=1mm, shorten <=1mm}}
\begin{tikzpicture}[>=latex]
\node[rectangle, draw] (RX) at (0, 0) {Rx};
\node[
rectangle,
draw,
minimum height=3cm,
text width=1.8cm,
text centered
]
(PFB_CHANNELIZER) at ($(RX) + (3, 0)$)
{PFB\ Channelizer};
\draw[->]
(RX)
--
(
$(PFB_CHANNELIZER.north west)
!0.5!
(PFB_CHANNELIZER.south west)$
);
\foreach \i in {0.15, 0.35}
{
\draw[->]
(
$(PFB_CHANNELIZER.north east)
!\i!
(PFB_CHANNELIZER.south east)$
)
coordinate (PFB_\thecnt)
to
++(1.5, 0)
coordinate (STR_TO_VEC_\thecnt)
node[str_to_vec, anchor=west] {stream to vector};
\draw[->]
(STR_TO_VEC_\thecnt.east)
to
++(5, 0)
coordinate (MODULUS2_\thecnt)
node[modulus2, anchor=west] {$\norm{\cdot}^2$};
\draw[->]
(MODULUS2_\thecnt.east)
to
++(5, 0)
coordinate (THRESHOLD_\thecnt)
node[thresh, anchor=west] {threshold};
\stepcounter{cnt}
}
\draw[->]
(
$(PFB_CHANNELIZER.north east)
!0.85!
(PFB_CHANNELIZER.south east)$
)
coordinate (PFB_3)
to
++(1.5, 0)
coordinate (STR_TO_VEC_3)
node[str_to_vec, anchor=west] {stream to vector};
\draw[->]
(STR_TO_VEC_3.east)
to
++(5, 0)
coordinate (MODULUS2_3)
node[modulus2, anchor=west] {$\norm{\cdot}^2$};
\draw[->]
(MODULUS2_3.east)
to
++(5, 0)
coordinate (THRESHOLD_3)
node[thresh, anchor=west] {threshold};
\draw[dottedline]
(STR_TO_VEC_1.south)
--
(STR_TO_VEC_3.north);
\draw[dottedline]
(MODULUS2_1.south)
--
(MODULUS2_3.north);
\end{tikzpicture}
\end{document}
这会产生一个奇怪的输出
(可能是因为 anchor=west
)选项,我不知道没有这些选项怎么办。有人可以帮我吗 ?
谢谢你,祝你有愉快的一天,亚历克斯
问题是您是从上一个箭头而不是从上一个节点绘制箭头。如果您改为向节点添加名称(下例中的 foo
),新箭头将不会绘制在旧节点上:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,calc}
\usepackage{amsmath, amssymb, mathtools}
\usepackage{physics}
\newcounter{cnt}\setcounter{cnt}{0}
\begin{document}
\tikzset{str_to_vec/.style = {rectangle, draw, minimum width=3cm, text centered}}
\tikzset{modulus2/.style = {rectangle, draw, text centered}}
\tikzset{thresh/.style = {rectangle, draw, text centered}}
\tikzset{dottedline/.style = {ultra thick, loosely dotted,shorten >=1mm, shorten <=1mm}}
\begin{tikzpicture}[>=latex]
\draw[->]
(0,0)
to
++(5, 0)
coordinate (MODULUS2_3)
node[modulus2, anchor=west] (foo) {$\norm{\cdot}^2$};
\draw[->]
(foo)
to
++(5, 0)
coordinate (THRESHOLD_3)
node[thresh, anchor=west] {threshold};
\end{tikzpicture}
\end{document}
感谢@samcarter_is_at_topanswers.xyz的回答,效果不错的代码是
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,calc}
\usepackage{amsmath, amssymb, mathtools}
\usepackage{physics}
\newcounter{cnt}\setcounter{cnt}{0}
\begin{document}
\tikzset{str_to_vec/.style = {rectangle, draw, minimum width=3cm, text centered}}
\tikzset{modulus2/.style = {rectangle, draw, text centered}}
\tikzset{thresh/.style = {rectangle, draw, text centered}}
\tikzset{dottedline/.style = {ultra thick, loosely dotted,shorten >=1mm, shorten <=1mm}}
\begin{tikzpicture}[>=latex]
%===========
% NODES
%===========
\node[rectangle, draw] (RX) at (0, 0) {Rx};
\node[
rectangle,
draw,
minimum height=3cm,
text width=1.8cm,
text centered
]
(PFB_CHANNELIZER) at ($(RX) + (3, 0)$)
{PFB\ Channelizer};
% %=================
% % CONNECTIONS
% %=================
\draw[->]
(RX)
--
(
$(PFB_CHANNELIZER.north west)
!0.5!
(PFB_CHANNELIZER.south west)$
);
\foreach \i in {0.15, 0.35}
{
\draw[->]
(
$(PFB_CHANNELIZER.north east)
!\i!
(PFB_CHANNELIZER.south east)$
)
coordinate (PFB_\thecnt)
to
++(1.5, 0)
node[str_to_vec, anchor=west] (STR_TO_VEC_\thecnt) {stream to vector};
\draw[->]
(STR_TO_VEC_\thecnt.east)
to
++(1.5, 0)
node[modulus2, anchor=west] (MODULUS2_\thecnt) {$\norm{\cdot}^2$};
\draw[->]
(MODULUS2_\thecnt.east)
to
++(1.5, 0)
node[thresh, anchor=west] (THRESHOLD_\thecnt) {threshold};
\stepcounter{cnt}
}
\draw[->]
(
$(PFB_CHANNELIZER.north east)
!0.85!
(PFB_CHANNELIZER.south east)$
)
coordinate (PFB_3)
to
++(1.5, 0)
node[str_to_vec, anchor=west] (STR_TO_VEC_3) {stream to vector};
\draw[->]
(STR_TO_VEC_3.east)
to
++(1.5, 0)
node[modulus2, anchor=west] (MODULUS2_3) {$\norm{\cdot}^2$};
\draw[->]
(MODULUS2_3.east)
to
++(1.5, 0)
node[thresh, anchor=west] (THRESHOLD_3) {threshold};
\draw[dottedline]
(STR_TO_VEC_1.south)
--
(STR_TO_VEC_3.north);
\draw[dottedline]
(MODULUS2_1.south)
--
(MODULUS2_3.north);
\draw[dottedline]
(THRESHOLD_1.south)
--
(THRESHOLD_3.north);
\end{tikzpicture}
\end{document}
我想以图形方式说明带宽分段器。为此,我想在 TikZ
到目前为止,我有以下 LaTeX 代码
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,calc}
\usepackage{amsmath, amssymb, mathtools}
\usepackage{physics}
\newcounter{cnt}\setcounter{cnt}{0}
\begin{document}
\tikzset{str_to_vec/.style = {rectangle, draw, minimum width=3cm, text centered}}
\tikzset{modulus2/.style = {rectangle, draw, text centered}}
\tikzset{thresh/.style = {rectangle, draw, text centered}}
\tikzset{dottedline/.style = {ultra thick, loosely dotted,shorten >=1mm, shorten <=1mm}}
\begin{tikzpicture}[>=latex]
\node[rectangle, draw] (RX) at (0, 0) {Rx};
\node[
rectangle,
draw,
minimum height=3cm,
text width=1.8cm,
text centered
]
(PFB_CHANNELIZER) at ($(RX) + (3, 0)$)
{PFB\ Channelizer};
\draw[->]
(RX)
--
(
$(PFB_CHANNELIZER.north west)
!0.5!
(PFB_CHANNELIZER.south west)$
);
\foreach \i in {0.15, 0.35}
{
\draw[->]
(
$(PFB_CHANNELIZER.north east)
!\i!
(PFB_CHANNELIZER.south east)$
)
coordinate (PFB_\thecnt)
to
++(1.5, 0)
coordinate (STR_TO_VEC_\thecnt)
node[str_to_vec, anchor=west] {stream to vector};
\draw[->]
(STR_TO_VEC_\thecnt.east)
to
++(5, 0)
coordinate (MODULUS2_\thecnt)
node[modulus2, anchor=west] {$\norm{\cdot}^2$};
\draw[->]
(MODULUS2_\thecnt.east)
to
++(5, 0)
coordinate (THRESHOLD_\thecnt)
node[thresh, anchor=west] {threshold};
\stepcounter{cnt}
}
\draw[->]
(
$(PFB_CHANNELIZER.north east)
!0.85!
(PFB_CHANNELIZER.south east)$
)
coordinate (PFB_3)
to
++(1.5, 0)
coordinate (STR_TO_VEC_3)
node[str_to_vec, anchor=west] {stream to vector};
\draw[->]
(STR_TO_VEC_3.east)
to
++(5, 0)
coordinate (MODULUS2_3)
node[modulus2, anchor=west] {$\norm{\cdot}^2$};
\draw[->]
(MODULUS2_3.east)
to
++(5, 0)
coordinate (THRESHOLD_3)
node[thresh, anchor=west] {threshold};
\draw[dottedline]
(STR_TO_VEC_1.south)
--
(STR_TO_VEC_3.north);
\draw[dottedline]
(MODULUS2_1.south)
--
(MODULUS2_3.north);
\end{tikzpicture}
\end{document}
这会产生一个奇怪的输出 anchor=west
)选项,我不知道没有这些选项怎么办。有人可以帮我吗 ?
谢谢你,祝你有愉快的一天,亚历克斯
问题是您是从上一个箭头而不是从上一个节点绘制箭头。如果您改为向节点添加名称(下例中的 foo
),新箭头将不会绘制在旧节点上:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,calc}
\usepackage{amsmath, amssymb, mathtools}
\usepackage{physics}
\newcounter{cnt}\setcounter{cnt}{0}
\begin{document}
\tikzset{str_to_vec/.style = {rectangle, draw, minimum width=3cm, text centered}}
\tikzset{modulus2/.style = {rectangle, draw, text centered}}
\tikzset{thresh/.style = {rectangle, draw, text centered}}
\tikzset{dottedline/.style = {ultra thick, loosely dotted,shorten >=1mm, shorten <=1mm}}
\begin{tikzpicture}[>=latex]
\draw[->]
(0,0)
to
++(5, 0)
coordinate (MODULUS2_3)
node[modulus2, anchor=west] (foo) {$\norm{\cdot}^2$};
\draw[->]
(foo)
to
++(5, 0)
coordinate (THRESHOLD_3)
node[thresh, anchor=west] {threshold};
\end{tikzpicture}
\end{document}
感谢@samcarter_is_at_topanswers.xyz的回答,效果不错的代码是
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,calc}
\usepackage{amsmath, amssymb, mathtools}
\usepackage{physics}
\newcounter{cnt}\setcounter{cnt}{0}
\begin{document}
\tikzset{str_to_vec/.style = {rectangle, draw, minimum width=3cm, text centered}}
\tikzset{modulus2/.style = {rectangle, draw, text centered}}
\tikzset{thresh/.style = {rectangle, draw, text centered}}
\tikzset{dottedline/.style = {ultra thick, loosely dotted,shorten >=1mm, shorten <=1mm}}
\begin{tikzpicture}[>=latex]
%===========
% NODES
%===========
\node[rectangle, draw] (RX) at (0, 0) {Rx};
\node[
rectangle,
draw,
minimum height=3cm,
text width=1.8cm,
text centered
]
(PFB_CHANNELIZER) at ($(RX) + (3, 0)$)
{PFB\ Channelizer};
% %=================
% % CONNECTIONS
% %=================
\draw[->]
(RX)
--
(
$(PFB_CHANNELIZER.north west)
!0.5!
(PFB_CHANNELIZER.south west)$
);
\foreach \i in {0.15, 0.35}
{
\draw[->]
(
$(PFB_CHANNELIZER.north east)
!\i!
(PFB_CHANNELIZER.south east)$
)
coordinate (PFB_\thecnt)
to
++(1.5, 0)
node[str_to_vec, anchor=west] (STR_TO_VEC_\thecnt) {stream to vector};
\draw[->]
(STR_TO_VEC_\thecnt.east)
to
++(1.5, 0)
node[modulus2, anchor=west] (MODULUS2_\thecnt) {$\norm{\cdot}^2$};
\draw[->]
(MODULUS2_\thecnt.east)
to
++(1.5, 0)
node[thresh, anchor=west] (THRESHOLD_\thecnt) {threshold};
\stepcounter{cnt}
}
\draw[->]
(
$(PFB_CHANNELIZER.north east)
!0.85!
(PFB_CHANNELIZER.south east)$
)
coordinate (PFB_3)
to
++(1.5, 0)
node[str_to_vec, anchor=west] (STR_TO_VEC_3) {stream to vector};
\draw[->]
(STR_TO_VEC_3.east)
to
++(1.5, 0)
node[modulus2, anchor=west] (MODULUS2_3) {$\norm{\cdot}^2$};
\draw[->]
(MODULUS2_3.east)
to
++(1.5, 0)
node[thresh, anchor=west] (THRESHOLD_3) {threshold};
\draw[dottedline]
(STR_TO_VEC_1.south)
--
(STR_TO_VEC_3.north);
\draw[dottedline]
(MODULUS2_1.south)
--
(MODULUS2_3.north);
\draw[dottedline]
(THRESHOLD_1.south)
--
(THRESHOLD_3.north);
\end{tikzpicture}
\end{document}