![LaTex - 使用 Tikz 绘制 LFSR](https://linux22.com/image/432001/LaTex%20-%20%E4%BD%BF%E7%94%A8%20Tikz%20%E7%BB%98%E5%88%B6%20LFSR.png)
我想知道如何使用 TikZ 在 LaTex 中绘制以下 LFSR:
我尝试过的:
\usetikzlibrary{arrows, calc, chains, positioning}
\begin{tikzpicture}[node distance = 4mm and 0mm,
box/.style = {shape=rectangle, draw, minimum size=2em, outer sep=0pt, on chain=#1},
sum/.style = {shape=circle, draw, inner sep=0pt, node contents={$+$}},
every path/.append style = {-latex'}
]
\def\scopeyshift{19mm}
\begin{scope}[start chain=ch1 going left]
\foreach \i in {0,...,7}{\node [box=ch1] (ch1-\i) {$s_{\i}$};}
\node (c2) [sum,below=of ch1-2];
\node (c6) [sum,below=of ch1-6];
\draw (ch1-0) |- (c2)
(c2) edge (c6);
\draw (c2) -| ([xshift=-5mm] ch1-7.west) -- (ch1-7);
\draw (c6) -| ([xshift=-5mm] ch1-7.west) -- (ch1-7);
\draw (ch1-2) -- (c2);
\draw (ch1-6) -- (c6);
\end{scope}
它看起来是这样的(这显然是错误的):
预先感谢您的任何帮助。
答案1
我做了一些小调整,希望它能满足您的需要。
\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows, calc, chains, positioning}
\begin{document}
\begin{tikzpicture}[node distance = 4mm and 0mm,
box/.style = {shape=rectangle, draw, minimum size=2em, outer sep=0pt, on chain=#1},
sum/.style = {shape=circle, draw, inner sep=0pt, node contents={$+$}},
every path/.append style = {-latex'}
]
\def\scopeyshift{19mm}
\begin{scope}[start chain=ch1 going left]
\foreach \i in {0,...,7}{
\node [box=ch1] (ch1-\i) {$s_{\i}$};
}
\node (c2) [sum,below=of ch1-2];
\node (c6) [sum,below=of ch1-6];
\draw (c2) edge (c6);
\draw (ch1-0) -- ($(ch1-0) + (2,0)$) node (knot){};
\draw[fill=black] ($(knot) - (1,0)$) circle[radius=0.75pt];
\draw ($(knot) - (1,0)$) |- (c2);
\draw (c6) -| ([xshift=-5mm] ch1-7.west) -- (ch1-7);
\draw (ch1-2) -- (c2);
\draw (ch1-6) -- (c6);
\end{scope}
\end{tikzpicture}
\end{document}