答案1
随着最近的 Ti钾Z ,使用库arrows.meta
、chains
和positioning
:quotes
\documentclass[border=3.141592]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
chains,
positioning,
quotes}
\begin{document}
\begin{tikzpicture}[
node distance = 3mm and 6mm,
start chain = A going right,
start chain = B going right,
arr/.style = {-{Straight Barb[scale=0.8]}},
every edge/.style = {draw, arr},
every edge quotes/.append style = {auto, inner ysep=1pt, font=\footnotesize},
lbl/.style = {pos=0.95, #1, inner sep=2pt, xshift=-1pt, font=\tiny},
lbl/.default = left,
box/.style = {draw, semithick, minimum size = 1em},
int/.style = {draw, semithick, minimum height = 4ex,
font=\Huge, node contents={$\int$},
},
sum/.style = {circle, draw, semithick, minimum size = 1em,
inner sep=0pt, font=\large, node contents={$+$},
},
]
\begin{scope}[nodes={fill=red!30, on chain=A}]
\coordinate (aux); % A-1
\node[sum]; % A-2
\node[int];
\node[box] {$2$};
\node[sum];
\coordinate[right=13mm of A-5] (aux);
\node[box, below=of A-3] {$-1$};
\end{scope}
%
\path (A-1) edge["$u$"] coordinate (aux1)
node[lbl, above] {$-$} (A-2)
(A-2) edge["$\dot{x}_1$"] (A-3)
(A-3) edge coordinate (aux2) (A-4)
(A-4) edge (A-5)
(A-5) edge["$2x_1-x_2$"] (A-6);
\draw[arr] (aux2) |- (A-7);
\draw[arr] (A-7) -| (A-2) node[lbl] {$+$};
%%%%
\begin{scope}[nodes={fill=red!30, on chain=B}]
\node[sum, below=13mm of A-2]; % B-1
\node[int];
\node[box] {$-1$};
\node[box, below=of B-2] {$-2$};
\end{scope}
%
\path (B-1) edge["$\dot{x}_2$"] (B-2)
(B-2) edge["$x_2$"] coordinate (aux3) (B-3);
\draw[arr] (aux1) |- (B-1) node[lbl=above] {$-$};
\draw[arr] (B-3) -| (A-5) node[lbl] {$+$};
\draw[arr] (aux3) |- (B-4);
\draw[arr] (B-4) -| (B-1) node[lbl] {$+$};
\end{tikzpicture}
\end{document}