答案1
此图表使用 TikZ 制作。一个好的做法是使用定义自己的样式,tikzset
通常使用n args
和定义default
样式来创建一定程度的灵活性。
我是这样创建样式的:addCross
、mySimpleArrow
和myBlock
。编写这些命令是为了让我可以将它们作为范围块的可选参数,即。请注意,您可以随意编辑箭头样式。如果您想要颜色,只需在范围块中\begin{scope}[opt args]
使用类似 的语法,mySimpleArrow={blue}{red}
而不是。mySimpleArrow
第一个作用域块定义图表的主要节点,即圆形和正方形。最后一个作用域负责绘制节点之间的连接。
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\tikzset{addCross/.style n args={6}{
minimum size={#5 mm},
path picture={
\draw[#6]
(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 at ($(path picture bounding box.south)!0.4!(path picture bounding box.center)$) {#1};
\node at ($(path picture bounding box.west)!0.4!(path picture bounding box.center)$) {#2};
\node at ($(path picture bounding box.north)!0.4!(path picture bounding box.center)$) {#3};
\node at ($(path picture bounding box.east)!0.4!(path picture bounding box.center)$) {#4};
}
},
addCross/.default={}{}{}{}{10}{}
}
\tikzset{mySimpleArrow/.style n args={2}{
>={latex[#1]},
every path/.style={draw=#2}
},
mySimpleArrow/.default={black}{black}
}
\tikzset{myBlock/.style ={
every node/.style={rectangle,draw, text=black,
minimum width=1.5cm, minimum height=1.5cm,}
}
}
\begin{document}
\begin{tikzpicture}[ultra thick, font={\Large}]
\node[draw,circle,addCross={\small$+$}{}{\small$+$}{}{10}{}] (S) at (2,0) {};
\begin{scope}[myBlock]
\node (G1) at (0,1) {$G_1(s)$};
\node (G2) at (0,-1) {$G_2(s)$};
\end{scope}
\begin{scope}[mySimpleArrow]
\path[->] (G1) -| (S) node[above, midway]{$Y_1(s)$};
\path[->] (G2) -| (S) node[below, midway]{$Y_2(s)$};
\path[->] (-3,0) node[above]{$U(s)$} -- ++(1,0) coordinate(U) |- (G1) node[above, midway]{$U_1(s)$};
\path[->] (U) |- (G2) node[below, midway]{$U_2(s)$};
\path[->] (S) -- ++(2,0) node[above]{$Y(s)$};
\end{scope}
\end{tikzpicture}
\end{document}
PS 我想说的是,你的图片来自一本 Ogata 的书。虽然这个例子没有完全重现箭头样式,但我认出了箭头样式。