控制系统图

控制系统图

我在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}

在此处输入图片描述

一些评论:

  1. 我将有问题的of=语法更改为=of加载positioning库的适当语法。

  2. 我将弃用的\tikzstyle语法更改为适当的\tikzset语法。

相关内容