有没有一种简单的方法可以使用“plot”命令将 tikz 绘图封装为节点样式的一部分?

有没有一种简单的方法可以使用“plot”命令将 tikz 绘图封装为节点样式的一部分?

我想要将一个函数叠加在一个块的顶部,如下面“有界倒数”所示。

有没有简单的方法可以做到这一点?有人向我推荐了下面 PIctrl 形状中的方法,但我不确定如何使用plot命令执行类似操作。

在此处输入图片描述

\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning, calc}
\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) {};

\node[block, right=10mm of block1, label={below:bounded reciprocal}] (block2) {};
\coordinate (recip0) at ($(block2.south west)+(1.5mm,1.5mm)$);
\draw[shift=(recip0)] (0,0) -- (0,7mm);
\draw[shift=(recip0)] (0,0) -- (9mm,0);
\draw[shift=(recip0),
           scale=0.5, domain=0.17:0.55, smooth, variable=\x, 
           black, dash pattern = {on 0.5mm off 0.5mm}, dash phase=0.9mm ] plot ({\x}, {0.25/\x});
\draw[shift=(recip0),
           scale=0.5, domain=0:1.8, samples=40, smooth, variable=\x, 
           black, thick ] plot ({\x}, {0.25/max(\x,0.3)});

\draw [->] (block1) -- (block2);


\end{tikzpicture}
\end{document}

相关内容