LaTeX 中的复杂电路绘图

LaTeX 中的复杂电路绘图

在此处输入图片描述

这种电路该怎么画呢?

\documentclass[12pt,a4size]{article}
\usepackage{circuitikz}
\begin{document}
 \begin{circuitikz}
   \node[and port, number inputs=1] (A) at (0, 0) {};
        \node at (A) [ocirc] {};
        \node[left] at (A.in 1) {\(x\)};
        \node[left] at (A.in 2) {\(y\)};
        
        \node[and port, number inputs=1] (B) at (0,4) {};
        \node[left] at (B.in 2) {\(y\)};
        
        
        \draw (A.out) -- ++ (2,0) -- ++ (0,0.28) -- ++ (0.5,0) (B.left);
 \end{circuitikz}
\end{document}

这是不完整的编码。我尽我所能了。我是初学者circuitikz。感谢您的帮助。

答案1

在此处输入图片描述

这是其中一种方法

\documentclass{article}
\usepackage{tikz}
\usepackage{circuitikz}
\begin{document}
    \begin{circuitikz}
        % Gates
        \node[and port] (and1) at (0, 0) {};
        \node[and port] (and2) at (0, -2) {};
        \node[not port, scale=0.5] (not) at ($(and2.in 2) - (2, 0)$) {};
        \node[or port] (or) at (4, -1) {};
        
        % Circuit inputs
        \node (in1) at ($(and1.in 1) - (3, 0)$) {};
        \node (in2) at ($(and1.in 2) - (3, 0)$) {};
        \node (in3) at ($(and2.in 1) - (3, 0)$) {};
        \node (in4) at ($(and2.in 2) - (3, 0)$) {};
        
        % Input wires
        \draw (in1) -- (and1.in 1);
        \draw (in2) -- (and1.in 2);
        \draw (in3) -- (and2.in 1);
        \draw (in4) -- (not.in);
        \draw (not.out) -- (and2.in 2) node[midway, below] {\(z'\)};
        
        % Input labels
        \node at (in1) {\(x\)};
        \node at (in2) {\(y\)};
        \node at (in3) {\(y\)};
        \node at (in4) {\(z\)};
        
        % Output wires from first round of gates
        \draw (and1.out) -- ++ (1, 0) |- (or.in 1) node[midway, above right] {\(xy\)};
        \draw (and2.out) -- ++ (1, 0) |- (or.in 2) node[midway, below right] {\(yz'\)};
        
        % Final output
        \draw (or.out) -- ++ (1, 0) node[right] {\(xy + yz'\)};
    \end{circuitikz}
\end{document}

这将利用|-,以及 ,-|允许您投影出单个坐标。即(A |- B)具有x与节点 相同的坐标(A)y与节点 相同的坐标(B)。同样,(A -| B)具有x与 相同的坐标(B)和与 相同的y坐标(A)

相关内容