使用 TikZ 绘制图块步骤和饱和度

使用 TikZ 绘制图块步骤和饱和度

我想用 TikZ 选项创建类似此图的东西

在此处输入图片描述

在这里我向你展示我所知道的方法:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{arrows,calc,positioning}

\tikzset{
    block/.style = {draw, rectangle,
                    minimum height=1cm,
                    minimum width=2cm},
    input/.style = {coordinate,node distance=1cm},
    output/.style = {coordinate,node distance=1cm},
    arrow/.style={draw, -latex,node distance=2cm},
    pinstyle/.style = {pin edge={latex-, black,node distance=2cm}},
    sum/.style = {draw, circle, node distance=1cm}
}

\begin{document}

\begin{figure}[ht]
    \begin{center}
        \begin{tikzpicture}[auto, node distance=1cm,>=latex']
            \node [input, name=input] {$\pm 2.5V$};
            \node [block, right=of input] (TF) {$G_m(s)$};
            \node [block, right=of TF] (plant) {$0.003$};
            \node [output, right=of plant] (output) {};
            \draw [->] (input) -- node {$\pm 2.5V$} (TF);
            \draw [->] (TF) -- (plant);
            \draw [->] (plant) -- node [name = y] {$y(s)$} (output);
        \end{tikzpicture}
    \end{center}
\caption{TikzPicture}\label{fig}
\end{figure}
    
\end{document}

非常感谢大家!:D

答案1

对图片元素样式进行了新的定义:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                positioning,
                quotes}
\newcommand\ppbb{path picture bounding box} % <---

\begin{document}

\begin{figure}[ht]
    \centering
    \begin{tikzpicture}[
    node distance = 12mm,
       box/.style = {draw,
                     minimum height=11mm, minimum width =12mm,
                     label=#1},
every edge/.style = {draw, -Straight Barb, semithick},
every edge quotes/.append style = {font=\footnotesize},
      step/.style = {box=#1, 
                     path picture={\draw[very thick] 
                            (\ppbb.center) |- ++ (-2mm,-3mm)
                            (\ppbb.center) |- ++ (+2mm,+3mm);}
                     },
       sat/.style = {box=#1,
                     path picture={\draw[very thick] 
                            (\ppbb.center) -- ++ (-1mm,-3mm) -- ++ (-2mm,0)
                            (\ppbb.center) -- ++ (+1mm,+3mm) -- ++ (+2mm,0);}
                     }
                        ]
\coordinate (in);
\node (n1) [step=Step, right=of in]   {};         % A-2
\node (n2) [sat=Saturation, right=of n1]   {};
\node (n3) [box=Motor, right=of n2]   {$G_m(s)$};
\node (n4) [box=Conversion, right=of n3]   {$0.003$};  % A-5
\coordinate[right=of n4] (out);
%
\path   (in)    edge                (n1)
        (n1)    edge                (n2) 
        (n2)    edge ["$\pm 2.5V$"] (n3) 
        (n3)    edge                (n4)
        (n4)    edge ["$y(s)$"]     (out);
    \end{tikzpicture}
\caption{TikzPicture}
\label{fig}
    \end{figure}
\end{document}

给出

在此处输入图片描述

相关内容