这是我的代码。
\documentclass[12pt,letterpaper]{article}
\usepackage[left=20mm,top=30mm,bottom=30mm,right=20mm]{geometry}
\usepackage{tikz} % for drawing pictures
\usetikzlibrary{arrows.meta,
chains,
positioning,
quotes,
shapes.geometric, arrows}
\begin{tikzpicture}[auto,
node distance = 15mm and 10mm,
start chain = going right,
arr/.style = {->},>=Latex,
block/.style = {draw, minimum height=3em, minimum
width=4em,align=center,fill=blue!20},
sum/.style = {circle, draw, node contents={}},
]
\begin{scope}[nodes={on chain, join=by arr}]
\coordinate (in);
\node (n2) [block] {$n_2$};
\node (n4) [block] {$K$};
\node (n1) [sum];
\coordinate (out);
\end{scope}
\node (n5) [block, above=of n4] {$\mbox{\huge$\times$}$};
\node (n11) [block, above=of n5] {$K_M$};
\node (n12) [block, below=of n4] {$N()$};
\path (n4) to [pos=0.8,"$r~~~+$"] (n1)
to ["$y_f$"{name=y}] (out);
\draw [->] (n11) -- (n5);
\draw[-] (n12.west) -- ++ (-6mm, 0) |- (n5.west) node[above left] {$+$};
\draw[-] (n12.east) -- ++ (20mm, 0) |- (n5.east) node[above right] {$+$};
\end{tikzpicture}
\end{document}
这是我得到的。我不知道如何让这条线更长。
这就是我想要实现的目标。
我是说这条线,已经用红笔标记了。见下图。
答案1
\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary{arrows.meta, chains, quotes}
\begin{document}
\begin{tikzpicture}[
node distance=15mm and 10mm,
start chain=going right,
arr/.style={->}, >=Latex,
block/.style={draw, minimum height=3em, minimum
width=4em, align=center, fill=blue!20},
sum/.style={circle, draw, node contents={}},
]
\begin{scope}[nodes={on chain, join=by arr}]
\coordinate (in);
\node[block] (n2) {$n_2$};
\node[block] (n4) {$K$};
\node[xshift=3cm] (n1) [sum];
\coordinate (out);
\end{scope}
\node[block, above=of n4] (n5) {$\mbox{\huge$\times$}$};
\node[block, above=of n5] (n11) {$K_M$};
\node[block, below=of n4] (n12) {$N()$};
\path (n4) to[pos=0.8,"$r~~~+$"] (n1) to["$y_f$"{name=y}] (out);
\draw[->] (n11) -- (n5);
\draw (n12.west) -- ++ (-6mm, 0) |- (n5.west) node[above left] {$+$};
\draw (n12.east) -- ++ (20mm, 0) |- (n5.east) node[above right] {$+$};
\end{tikzpicture}
\end{document}