在 tikzpicture 中的一个块内

在 tikzpicture 中的一个块内

我想在块内插入一个方波而不是 X

与此脉冲类似,但没有轴和标签,只有方波

在此处输入图片描述

\documentclass[borders=5cm,circuitikz]{standalone}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes,arrows}
\begin{document}
% Definition of blocks:
\tikzset{%
  block/.style    = {draw, thick, rectangle,
  anchor=west,
  rounded corners,align=center},
  sum/.style      = {draw, circle, node distance = 2cm}, % Adder
  input/.style    = {coordinate}, % Input
  output/.style   = {coordinate} % Output
}
\begin{tikzpicture}[auto, thick, node distance=2cm, >=triangle 45]
\draw
    % Drawing the blocks of first filter :
    node at (0,0)[input, name=input1,right=-1cm]{}
    node [block,right of=input1, minimum height = 3.5em,
    minimum width = 4.5em,  text width=4.5em,  node distance=2.5cm](block1) {X};
\end{tikzpicture}
\end{document}

答案1

在此处输入图片描述

\documentclass[borders=5cm,circuitikz]{standalone}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{arrows.meta, backgrounds, calc, fit, positioning}

\begin{document}
    % Definition of blocks:
    \tikzset{%
         do path picture/.style={%
            path picture={%
                \pgfpointdiff{\pgfpointanchor{path picture bounding box}{south west}}%
                {\pgfpointanchor{path picture bounding box}{north east}}%
                \pgfgetlastxy\x\y%
                \tikzset{x=\x/2,y=\y/2}%
                #1
            }
        },
        block/.style    = {draw, thick, rectangle,
                            anchor=west,
                            rounded corners,align=center},
        sum/.style      = {draw, circle, node distance = 2cm}, % Adder
        input/.style    = {coordinate}, % Input
        output/.style   = {coordinate}, % Output
        sin wave/.style={do path picture= {
                \draw[very thin]  
                (-0.8,-0.3) -- ++ (0.4,0)-- ++ (0,0.8)--++(0.8,0)--++(0,-0.8) -- ++ (0.4,0);
        },
    }
}
    \begin{tikzpicture}[]

        \node   [block, 
                minimum height = 3.5em,
                minimum width = 4.5em, 
                draw,rounded corners=0pt, 
                sin wave] 
                at (0, 0) {};
    
    \end{tikzpicture}
\end{document}

相关内容