TikZ:如何将箭头置于其他路径的中心

TikZ:如何将箭头置于其他路径的中心

我怎样才能正确地将圆形箭头从线下方移动到线上?

\begin{tikzpicture}
\node[circle,draw,align=center,minimum width=1cm] (sum1) at (0,0) {\Large $+$};
\node[rectangle,draw,align=center,minimum width=2.5cm,minimum height=1.5cm] (c) at (3,0) {Controller\\$c(t)$};
\node[rectangle,draw,align=center,minimum width=2.5cm,minimum height=1.5cm] (g) at (7,0) {Plant\\$g(t)$};
\node[circle,draw,align=center,minimum width=1cm] (sum2) at (10,0) {\Large $+$};
\node[rectangle,draw,align=center,minimum width=2.5cm,minimum height=1.5cm] (f) at (5,-2.5) {Filter\\$f(t)$};

\draw[{Latex[length=3mm]}-] (sum1) -- node[pos=0.8,anchor=south] {$x(t)$} +(-1.75,0);
\draw[-{Latex[length=3mm]}] (sum1) -- node[pos=0.5,anchor=south] {$e(t)$} (c);
\draw[-{Latex[length=3mm]}] (c) -- node[pos=0.5,anchor=south] {$u(t)$} (g);
\draw[-{Latex[length=3mm]}] (g) -- node[pos=0.5,anchor=south] {} (sum2);
\draw[-{Latex[length=3mm]}] (sum2) -- node[pos=0.8,anchor=south] {$y(t)$} +(1.75,0);

\draw[Circle-{Latex[length=3mm]}] (sum2)+(1,0) |-   (f); %what to do here
%\draw[Circle-{Latex[length=3mm]}] (sum2)+(1,2pt) |-   (f); %bad solution

\draw[-{Latex[length=3mm]}] (f) -|node[pos=0.1,anchor=south] {$x_i(t)$} node[pos=0.9,anchor=west] {$-$}  (sum1);
\draw[{Latex[length=3mm]}-] (sum2) -- node[pos=0.8,anchor=west] {$d(t)$} +(0,1.75);
\end{tikzpicture}

问题

答案1

    \draw[-{Latex[length=3mm]}] ($(sum2)+(1,0)$)node[circle, fill, inner sep=1pt](){} |-(f); %what to do here

在此处输入图片描述

完成 MWE

\documentclass[10pt,a4paper]{article}

\usepackage{tikz}
\usetikzlibrary{arrows.meta, calc, shapes}
\begin{document}
    \begin{tikzpicture}
        \node[circle,draw,align=center,minimum width=1cm] (sum1) at (0,0) {\Large $+$};
        \node[rectangle,draw,align=center,minimum width=2.5cm,minimum height=1.5cm] (c) at (3,0) {Controller\\$c(t)$};
        \node[rectangle,draw,align=center,minimum width=2.5cm,minimum height=1.5cm] (g) at (7,0) {Plant\\$g(t)$};
        \node[circle,draw,align=center,minimum width=1cm] (sum2) at (10,0) {\Large $+$};
        \node[rectangle,draw,align=center,minimum width=2.5cm,minimum height=1.5cm] (f) at (5,-2.5) {Filter\\$f(t)$};
        
        \draw[{Latex[length=3mm]}-] (sum1) -- node[pos=0.8,anchor=south] {$x(t)$} +(-1.75,0);
        \draw[-{Latex[length=3mm]}] (sum1) -- node[pos=0.5,anchor=south] {$e(t)$} (c);
        \draw[-{Latex[length=3mm]}] (c) -- node[pos=0.5,anchor=south] {$u(t)$} (g);
        \draw[-{Latex[length=3mm]}] (g) -- node[pos=0.5,anchor=south] {} (sum2);
        \draw[-{Latex[length=3mm]}] (sum2) -- node[pos=0.8,anchor=south] {$y(t)$} +(1.75,0);

        \draw[-{Latex[length=3mm]}] ($(sum2)+(1,0)$)node[circle, fill, inner sep=1pt](){} |-(f); %what to do here

        \draw[-{Latex[length=3mm]}] (f) -|node[pos=0.1,anchor=south] {$x_i(t)$} node[pos=0.9,anchor=west] {$-$}  (sum1);
        \draw[{Latex[length=3mm]}-] (sum2) -- node[pos=0.8,anchor=west] {$d(t)$} +(0,1.75);
    \end{tikzpicture}
\end{document}

答案2

  • 最简单的方法(在我看来)是定义新的节点dot作为信号分裂点
  • 如果为sheme的元素定义样式并使用相对定位,控制shem的代码会更短更清晰:
\documentclass[border=3.141592]{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                calc, chains,
                positioning,
                quotes}

\begin{document}
    \begin{tikzpicture}[
node distance = 7mm and 11mm,
  start chain = going right,
   arr/.style = {-{Stealth[length=3mm]}},
   box/.style = {draw, thick, 
                 text width=25mm, minimum height=15mm, align=center},
   dot/.style = {circle, draw, fill, minimum size=2mm, inner sep=0pt,
                 node contents={}}, % new
   sum/.style = {circle, draw, thick, minimum size=8mm, font=\Large,
                 node contents={$+$}},
every edge/.append style = {draw, arr}
                        ]
   \begin{scope}[nodes={on chain}] % nodes are in chain
\coordinate (in);
\node (sum1)    [sum];
\node (c)       [box]   {Controller\\ $c(t)$};
\node (g)       [box]   {Plant\\ $g(t)$};
\node (sum2)    [sum];
\node (dot)     [dot];
\coordinate[right=of dot]   (out);
    \end{scope}
\node (f)       [box, below=of $(c.south)!0.5!(g.south)$] (f) {Filter\\ $f(t)$}; % feedback node
% connections
\coordinate[above=of sum2] (n);
\path   (in)    edge ["$x(t)$"]   (sum1)
        (sum1)  edge ["$e(t)$"]   (c)
        (c)     edge ["$u(t)$"]   (g)
        (g)     edge              (sum2)
        (sum2)  edge [-]          (dot)
        (dot)   edge ["$y(t)$"]   (out)
        (n)     edge [pos=0.1, "$d(t)$"]   (sum2);
%
\draw[arr]  (dot)   |- (f);
\draw[arr]  (f.west)        node[above left] {$x_i(t)$}  -|
            (sum1.south)    node[below right] {$-$};
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容