tikzpicture 中箭头的起点

tikzpicture 中箭头的起点

我是使用 tikzpicture 绘制框图的新手。以下 MWE

\documentclass[a4paper,11pt]{article}

\usepackage{amsmath}
\usepackage{tikz} %http://www.texample.net/tikz/examples/control-system-principles/
\usetikzlibrary{shapes,arrows}
\tikzstyle{block} = [draw, fill=blue!20, rectangle, 
minimum height=3em, minimum width=6em]
\tikzstyle{sum} = [draw, fill=blue!20, circle, node distance=1cm]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\tikzstyle{pinstyle} = [pin edge={to-,thin,black}]

\begin{document}
\begin{tikzpicture}[auto, node distance=2cm,>=latex']
% We start by placing the blocks
\node [input, name=input] {};
\node [sum, right of=input, name=sum] (sum) {};
\node [block, right of=sum,label=below:controller] (controller) {?};
\node [sum, right of=controller,node distance=2cm,pin={[pinstyle]above:$D(s)$}] (sum2) {};
\node [block, right of=sum2,node distance=2cm,label=below:process dynamics] (system) {$\dfrac{32}{s(s+4)(s+16)}$};
% 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] {} (system);
\node [output, right of=system] (output) {};
\node [block, below of=u,label=below:sensor] (measurements) {1};
% Once the nodes are placed, connecting them is easy. 
\draw [draw,->] (input) -- node {$\varphi_d$} (sum);
\draw [->] (sum) -- node {} (controller);
\draw [->] (controller) -- node {} (sum2);
\draw [->] (sum2) -- node {} (system);
\draw [->] (system) -- node [name=y] {$\varphi$}(output);
\draw [->] (y) |- (measurements);
\draw [->] (measurements) -| node[pos=0.99] {\tiny $-$} 
    node [near end] {} (sum);
\end{tikzpicture}
\end{document}

产量

框图

我怎样才能让连接第二个总和到块“过程动态”的箭头从总和的右侧开始,而不是从左侧开始(参见橙色箭头)?

答案1

您可以使用(sum2.east)右侧的连接。

\draw [->] (controller) -- node {} (sum2.west);            %% used west
\draw [->] (sum2.east) -- node {} (system);                %% used east

此外,我\draw已将\path

\path [->] (controller) -- node[name=u] {} (system);      %% changed \draw to \path

完整代码:

\documentclass[a4paper,11pt]{article}

\usepackage{amsmath}
\usepackage{tikz} %http://www.texample.net/tikz/examples/control-system-principles/
\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, node distance=1cm},
        input/.style = {coordinate},
        output/.style = {coordinate},
        pinstyle/.style = {pin edge={to-,thin,black}}
}

\begin{document}
\begin{tikzpicture}[auto, >=latex']
% We start by placing the blocks
\node [input, name=input] {};
\node [sum, right =of input, name=sum] (sum) {};
\node [block, right = of sum,label=below:controller] (controller) {?};
\node [sum, right =of controller,pin={[pinstyle]above:$D(s)$}] (sum2) {};
\node [block, right = of sum2,label=below:process dynamics] (system) {$\dfrac{32}{s(s+4)(s+16)}$};
% We draw an edge between the controller and system block to
% calculate the coordinate u. We need it to place the measurement block.
\path [->] (controller) -- node[name=u] {} (system);      %% changed \draw to \path
\node [output, right = of system] (output) {};
\node [block, below =of u,label=below:sensor] (measurements) {1};
% Once the nodes are placed, connecting them is easy.
\draw [draw,->] (input) -- node {$\varphi_d$} (sum);
\draw [->] (sum) -- node {} (controller);
\draw [->] (controller) -- node {} (sum2.west);            %% used west
\draw [->] (sum2.east) -- node {} (system);                %% used east
\draw [->] (system) -- node [name=y] {$\varphi$}(output);
\draw [->] (y) |- (measurements);
\draw [->] (measurements) -| node[pos=0.99] {\tiny $-$}
    node [near end] {} (sum);
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容