Skip to content

Instantly share code, notes, and snippets.

@TorbjornT
Created September 24, 2020 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TorbjornT/b99c6e5833d5c440c26e567a552212ea to your computer and use it in GitHub Desktop.
Save TorbjornT/b99c6e5833d5c440c26e567a552212ea to your computer and use it in GitHub Desktop.
\documentclass[border=2mm]{standalone}
\usepackage{pgfplots}
\usetikzlibrary{positioning, calc, fit, backgrounds}
\pgfplotsset{
miniaxis/.style={
scale only axis,
width=8mm,
height=6mm,
axis lines=left,
axis line style={-},
xtick=\empty,ytick=\empty,
after end axis/.code={
\scoped[on background layer]
\node [block, fit=(current axis), #1] {};
}
}
}
\begin{document}
\begin{tikzpicture}[
PIctrl/.style={
append after command={
\pgfextra{\let\lastnode\tikzlastnode}
($(\lastnode.south west) + (0.5em,0.5em)$) edge
($(\lastnode.south east) + (-0.5em,0.5em)$) edge
($(\lastnode.north west) + (0.5em,-0.5em)$) edge[-, very thick]
($(\lastnode.north west) + (0.5em,-1.5em)$)
($(\lastnode.north west) + (0.5em,-1.5em)$) edge[-, very thick]
($(\lastnode.north east) + (-0.8em,-0.8em)$)
}
},
blockheight/.style = {
minimum height=10mm
},
block/.style={
draw,
% The shape:
rectangle, minimum size=6mm, minimum width=12mm,
blockheight,
node distance=5mm,
},
every node/.style = {font=\sffamily},
every label/.style={
font=\sffamily\scriptsize
},
>=latex
]
\node[block, PIctrl, label={below:PI controller}] (block1) at (0,0) {};
\begin{axis}[
miniaxis={name=block2,label=below:bounded reciprocal},
at={($(block1.east) + (1cm,0)$)},
anchor=west,
ymin=0
]
\addplot[domain=0.17:0.55, smooth, black, dash pattern = {on 0.5mm off 0.5mm}, dash phase=0.9mm ] {0.25/x};
\addplot [domain=0:1.8, samples=40, smooth, black, thick ] {0.25/max(x,0.3)};
\end{axis}
\draw [->] (block1) -- (block2);
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment