控制系統圖

控制系統圖

我發現了一個使用 TikZ 的控制系統的例子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語法。

相關內容