请问如何在 Latex 中绘制下图?我从一本日记中复制了该图。我目前正在使用 Tikz 包。谢谢你的帮助。
更新:
我的代码如下所示。
\begin{tikzpicture}
% Zero order block
\node[draw,
minimum width=2cm,
minimum height=1.2cm,
] (ZOH) at (0,0){$Hold (H)$};
% High altitude balloon block
\node [draw,
minimum width=2cm,
minimum height=1.2cm,
above right= 0.5cm and 1cm of ZOH
] (plant) {Plant (G) $\dot{x} = f(x(t), u(t), w(t))$};
% Sampler
\node [draw,
minimum width=2cm,
minimum height=1.2cm,
below right= 0.5cm and 1cm of plant
] (sampler) {Sampler $[k]$};
% Extremum seeking controller
\node [draw,
minimum width=2cm,
minimum height=1.2cm,
below right= 0.5cm and 1cm of ZOH]
(ESC) {Controller (K) ;
$\hat{u}_j = K(\hat{x}_j)$ };
% Arrows with text label
\draw[-stealth] (ZOH.north) |- (plant.west)
node[near end,above]{$u(t)$};
\draw[-stealth] (plant.east) -| (sampler.north)
node[near start,above]{$x(t)$};
\draw[-stealth] (sampler.south) |- (ESC.east)
node[near end,below]{$J[k]$};
\draw[-stealth] (ESC.west) -| (ZOH.south)
node[near start,below]{$\hat{u}_j$};
\end{tikzpicture}
答案1
希望这可以帮助:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows.meta}
\begin{document}
\begin{tikzpicture}[>=stealth]
% Zero order block
\node[draw=black!50,ultra thick,
minimum width=2.2cm,
minimum height=1cm,fill=cyan!30] (ZOH) at (0,0){Hold $(H)$};
% High altitude balloon block
\node [draw=black!50,
minimum width=2cm,
minimum height=1.5cm,
above right= 0.5cm and 1cm of ZOH,
align=center, ultra thick,fill=cyan!30
] (plant) {Plant (G)\\$\dot{x}(t) = f(x(t), u(t), w(t))$};
% Sampler
\node [draw=black!50,
minimum width=2cm,
minimum height=1.2cm,
below right= 0.5cm and 1cm of plant, ultra thick,fill=cyan!30,
align=center
] (sampler) {Sampler $(S)$\\sampling instants, $\{r_j\}$};
% Extremum seeking controller
\node [draw=black!50,
minimum width=3cm,
minimum height=1.5cm, ultra thick, fill=cyan!30,
below right= 0.5cm and 1.6cm of ZOH,
align=center]
(ESC) {Controller (K)\\
$\hat{u}_j = K(\hat{x}_j)$ };
% Arrows with text label
\draw[->,ultra thick] (ZOH.north) |- (1.9,1.7);
\draw (-0.5,1.7) node {$u(t)$};
\draw[->,ultra thick] (plant.east) -| (sampler.north)
node[near start,above]{$x(t)$};
\draw[->,ultra thick] (sampler.south) |- (ESC.east)
node[near end,below right]{$\hat{x}_j=x(r_j)$};
\draw[->,ultra thick] (ESC.west) -| (ZOH.south)
node[near end,left]{$\hat{u}_j$};
\draw[->, ultra thick] (0,2.2) node[anchor=east] {$w(t)$} -- (1.9,2.2);
\end{tikzpicture}
\end{document}
节点文本中的换行符的关键是使用align=center
。然后我只是改变了线条和箭头的粗细,移动了一些节点,改变了颜色,然后当然,在左上角附近添加了额外的箭头。