我在http://www.texample.net/tikz/examples/control-system-principles/。我想通过删除测量节点并仅保留循环来调整此示例,但作为tikz
新手,我无法得到我想要的。欢迎提出任何建议。
答案1
如果删除节点,您还需要更改使用该节点的路径,因此您不能再使用
\draw [->] (y) |- (measurements);
\draw [->] (measurements) -| node[pos=0.99] {$-$}
node [near end] {$y_m$} (sum);
但你可以使用类似
\draw [->] (y) -- ++(0,-2cm) -| node[pos=0.99] {$-$}
node [near end] {$y_m$} (sum);
代码:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning}
\tikzset{
block/.style={
draw,
fill=blue!20,
rectangle,
minimum height=3em,
minimum width=6em
},
sum/.style={
draw,
fill=blue!20,
circle,
},
input/.style={coordinate},
output/.style={coordinate},
pinstyle/.style={
pin edge={to-,thin,black}
}
}
\begin{document}
% The block diagram code is probably more verbose than necessary
\begin{tikzpicture}[auto,>=latex']
% We start by placing the blocks
\node [input, name=input] {};
\node [sum, right = of input] (sum) {};
\node [block, right = of sum] (controller) {Controller};
\node [block, right = of controller, pin={[pinstyle]above:Disturbances},
node distance=3cm] (system) {System};
% We draw an edge between the controller and system block to
% calculate the coordinate u. We need it to place the measurement block.
\draw [->] (controller) -- node[name=u] {$u$} (system);
\node [output, right =of system] (output) {};
%\node [block, below of=u] (measurements) {Measurements};
% Once the nodes are placed, connecting them is easy.
\draw [draw,->] (input) -- node {$r$} (sum);
\draw [->] (sum) -- node {$e$} (controller);
\draw [->] (system) -- node [name=y] {$y$}(output);
\draw [->] (y) -- ++(0,-2cm) -| node[pos=0.99] {$-$}
node [near end] {$y_m$} (sum);
\end{tikzpicture}
\end{document}
一些评论:
我将有问题的
of=
语法更改为=of
加载positioning
库的适当语法。我将弃用的
\tikzstyle
语法更改为适当的\tikzset
语法。