
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,fit}
\usetikzlibrary{arrows,calc,positioning}
\usetikzlibrary{shapes,arrows,positioning,calc}
\begin{document}
\newlength\estilength
\settowidth\estilength{$estimator$}
\tikzset{
block/.style = {draw, fill=white, rectangle, minimum height=3em, minimum width=3em,text width=\estilength,align=center},
tmp/.style = {coordinate},
sum/.style= {draw, fill=white, circle, node distance=1cm},
input/.style = {coordinate},
output/.style= {coordinate},
pinstyle/.style = {pin edge={to-,thin,black}
},
point/.style = {draw, fill=black, circle, minimum size=0.8mm, node distance=1.5cm, inner sep=0pt},
dashed node/.style={draw,dashed,inner sep=7.5pt,rounded corners},
}%
\begin{tikzpicture}[auto, node distance=15mm,>=latex']
\node [input, name=input] {};
\node [block, right=of input] (plant) {$controller$};
\end{tikzpicture}
\end{document}
答案1
這是一種方法。
特別是當您是 Tikz 的初學者時,我建議您逐步完成,在評論中查看我的數字,然後從不完善到很好(足夠)。
有些評論超出了我的評論:
- 作為初學者,使用絕對座標可以讓您更好地控制;稍後您可能會轉向
positioning
圖書館或其他工具 - 總是從簡單開始,例如
\draw (A) -- (B);
(直接),然後細化,例如\draw (A) |- (B);
(垂直,然後水平連接) - 使用樣式使程式碼更具可讀性
- 引入中間點,例如相對座標
+()
或新的絕對++()
座標 - Tikz 使用路徑概念,語法上以 開始
\
,以 結束;
,並執行其間的任何操作 - 這就是為什麼你可以在路徑完成之前放置
node
(不帶!)來放置標籤\
- 使用
anchor
可以很好地改變節點的引用center
- 極坐標可以是你的朋友,既可以作為坐標
(45:1)
,也可以圍繞節點形狀(A.north) == (A.90)
祝你好運+在中找到這些指令tikz 手冊在平行下。
\documentclass[10pt,border=3mm,tikz]{standalone}
% ~~~ (4) replace arrow tip ~~~~~~~~~~
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[ % ~~~ (2) doing some style ~~~
blk/.style={draw,minimum height=1cm,minimum width=3cm},
LL/.style={line width=3pt, draw=blue!70!green!40},
>={Triangle}, % ~~~ (4) replace arrow tip ~~~~~~~~~~
]
% ~~~ (1) putting a node ~~~~~~~~
\node[blk] (C) at (0,0) {controller};
% ~~~ (3) drawing the blue line ~~~~~~
\draw[->,LL] (6,1.5) -| (C);
% ~~~ (5) left indicator ~~~~~~~~~~~~
\draw[dashed] (C.120) -- ++(100:3) -- +(-4,0)
node[anchor=south west] {distributed controller};
% ~~~ (6) right indicator ~~~~~~~~~~~~
\draw[dashed] (2,1.5) -- ++(45:2) -- +(4,0)
node[anchor=south east] {communication topology}
node[anchor=north east,pos=.6] {delay}
;
\end{tikzpicture}
\end{document}