I want to draw a diagram like this. Could you please help me?

- 17,569
- 13
-
3Welcome to TeX.SX! Your question falls into the "do it for me" category, which is not well received here. There are plenty of similar questions on this very website to help you get started with this kind of diagram and I invite you to investigate them, or even look at the first examples of the TikZ manual. Then, if you have a specific problem with the code you have produced, people here will be glad to help you. – KersouMan Jul 03 '20 at 13:35
-
3Does this answer your question? Block diagram with Tikz – KersouMan Jul 03 '20 at 13:37
2 Answers
Despite my comment, I gave a quick try to your problem. Here is a possible solution using TikZ:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{fit}
\begin{document}
\begin{tikzpicture}
\tikzset{%
block/.style = {%
rectangle,
draw,
align = center
}
}
\node[block] (pid) at (0, 0) {PID\\Controller};
\node[
block,
right of = pid,
node distance = 3cm
] (plant) {Plant};
\node[
block,
draw = none,
below right of = plant,
node distance = 2cm
] (obj) {Objective\\evaluation};
\node[
block,
draw = none,
below left of = pid,
node distance = 2cm
] (param) {PID\\parameters};
\coordinate (mid) at ($(pid)!0.5!(plant)$);
\node[
block,
below of = mid,
node distance = 3cm
] (opt) {Stochastic optimization\\techniques};
\draw[-Latex] (pid.east) -- (plant.west);
\draw[-Latex] (plant.east) -| (obj.north);
\draw[-Latex] (obj.south) |- (opt.east);
\draw[-Latex] (opt.west) -| (param.south);
\draw[-Latex] (param.north) |- (pid.west);
\node[
rectangle,
above of = mid,
node distance = 1cm
] (sim) {System's simulation};
\node[
rectangle,
draw,
dashed,
fit = {(pid) (sim) (plant)}
] {};
\end{tikzpicture}
\end{document}
yielding:
However, I really encourage you to look at TikZ documentation for your future questions. If you want to tune what I propose to your needs, please, definitely look at TikZ documentation.
- 1,850
- 3
- 13
- 15
-
-
1@KersouMan Note that the
of=syntax is deprecated in favor of loading the positioning library and saying=of, see Difference between "right of=" and "right=of" in PGF/TikZ – js bibra Jul 03 '20 at 16:38
\documentclass[]{article}
\usepackage{tikz}
\usetikzlibrary{matrix,arrows,calc,math,shapes,arrows.meta,backgrounds,positioning}
\begin{document}
\begin{tikzpicture}[
terminal/.style={
rectangle,
minimum size=1cm,
text width=2cm,
align=center,
very thick,
draw=red!50!black!50, % 50% red and 50% black,
top color=white, % a shading that is white at the top...
bottom color=red!50!black!20, % and something else at the bottom
font=\itshape
}]
\tikzstyle{myarrows}=[line width=1mm,
draw=blue,
-triangle 45,
postaction={draw,
line width=3mm,
shorten >=4mm, -}]
\matrix[row sep=8mm,column sep=12mm] {
& \node terminal {PID\ Controller};
&
& \node terminal {Plant}; \
&
& \node [terminal] (p3){Stochastic Optimization Techniques};&\
};
\draw [myarrows] (p1)--(p2);
\coordinate [left=1cm of p1.west] (p){};
\draw [myarrows] (p2.east)--++(1cm,0)|-
node[
near start,
fill=white,
align=center
]
{\scriptsize $Objective$\\scriptsize $
Evaluation$}
(p3.east);
\draw [myarrows] (p3.west)-|
node[
near end,
fill=white,
align=center
]
{\scriptsize $PID$\ \scriptsize $Parameters$}(p)-
-(p1);
\draw[dashed, ultra thick]
(155:5cm)--++
(0,-2cm)--++
(10cm,0cm)--++
(0,2cm)--
node[
below,
fill=white
]
{\scriptsize $System Simulation$}
(155:5cm);
\end{tikzpicture}
\end{document}
EDIT-- A black and white answer --no prettifying
MWE
\documentclass[]{article}
\usepackage{tikz, tkz-euclide}% permet de dessiner des figures, des graphiques
\usetikzlibrary{matrix,arrows,calc,math,shapes,arrows.meta,backgrounds,positioning}
\begin{document}
\begin{tikzpicture}[
terminal/.style={
rectangle,
minimum size=1cm,
text width=2.2cm,
align=center,
very thick,
draw,
}
]
\tikzstyle{myarrows}=[
line width=2pt,
draw,
-latex,
]
\matrix[
row sep=4cm,
column sep=12mm
]
{%
&\node terminal {PID\ Controller};
&%
&\node terminal {Plant}; \
&
& \node [terminal] (p3){Stochastic Optimization Techniques};
& \
};
\draw [myarrows] (p1)--(p2) ;
\coordinate [left=1cm of p1.west] (p){} ;
\draw [myarrows] (p2.east)--
++(1cm,0)|-
node[
near start,
fill=white,
align=center
]
{ Objective\ Evaluation}
(p3.east);
\draw [myarrows] (p3.west)-|
node[
near end,
fill=white,
align=center
]
{PID\ Parameters}(p)--
(p1);
\draw[
dashed, red,
ultra thick
]
($(p1.west)+(-.5,2)$)--
node[
below,
fill=white
]
{System Simulation}
++(10.6,0)--
++(0,-3) -|
($(p1.west)+(-.5,2)$)
;
\end{tikzpicture}
\end{document}
- 21,280


