Re: Introduzione all’uso di TikZ in Ingegneria

#72975
claudio
Partecipante
    Up
    0
    Down
    ::


    circuirti realizzati con due librerie diverse
    `
    \usetikzlibrary{shapes.gates.logic.US,shapes.gates.logic.IEC}
    \tikzstyle{branch}=[fill,shape=circle,minimum size=3pt,inner sep=0pt]
    \begin{tikzpicture}
    \node (A) at (0,0) {A};
    \node (B) at (1,0) {B};
    \node (C) at (2,0) {C};
    \node[not gate US, draw] at ($(A)+(3,-2)$) (Not1) {};
    \node[not gate US, draw] at ($(B)+(2,-1)$) (Not2) {};
    \node[not gate US, draw] at ($(B)+(2,-2.5)$) (Not3) {};
    \node[not gate US, draw] at ($(B)+(2,-3.4)$) (Not4) {};
    \node[not gate US, draw] at ($(B)+(2,-3.9)$) (Not5) {};
    \node[and gate US, draw, logic gate inputs=nnn, anchor=input 2] at ($(Not1.output-|Not2.output)+(1,.5)$) (and1){};
    \node[and gate US, draw, logic gate inputs=nnn, anchor=input 3] at ($(Not3.output-|Not4.output)+(1,-.65)$) (and2){};
    \node[and gate US, draw, logic gate inputs=nnn, anchor=input 3] at ($(Not5.output)+(1,-.4)$) (and3){};
    \node[and gate US, draw, logic gate inputs=nnn, anchor=input 3] at ($(and3)+(-.4,-1.1)$) (and4){};
    \node[or gate US, draw, logic gate inputs=nnnn, anchor=input 2] at ($(and2)+(3,-.5)$) (or1){};
    \draw (B)|-node[branch] {}(Not1.input);
    \draw (A)|-node[branch] {}(Not2.input);
    \draw(C)|-node[branch] {}(and1);
    \draw(Not1.output)–([xshift=0.3cm]Not1.output) |-(and1.input 3);
    \draw(Not2.output)–([xshift=0.3cm]Not2.output) |-(and1.input 1);
    \draw (C)|-node[branch] {}(Not3.input);
    \draw (A)|-node[branch] {}(Not4.input);
    \draw(Not3.output)–([xshift=0.3cm]Not3.output) |-(and2.input 1);
    \draw(Not4.output)–([xshift=0.3cm]Not4.output) |-(and2.input 3);
    \draw(B)|-node[branch] {}(and2);
    %
    \draw(A)|-node[branch] {}(Not5.input);
    \draw(Not5.output)–([xshift=0.3cm]Not5.output) |-(and3.input 1);
    \draw(B)|-node[branch] {} (and3.input 2);
    \draw(C)|-node[branch] {} (and3.input 3);
    %
    \draw(A)|-node[branch] {}(and4.input 1);
    \draw(B)|- node[branch] {}(and4.input 2);
    \draw(C)|- node[branch] {}(and4.input 3);
    \draw(and1.output)– ([xshift=0.5cm]and1.output) |- (or1.input 1);
    \draw(and2.output)–([xshift=0.3cm]and2.output) |- (or1.input 2);
    \draw(and3.output)–([xshift=0.3cm]and3.output) |- (or1.input 3);
    \draw(and4.output)– ([xshift=0.5cm]and4.output) |- (or1.input 4);
    \draw (or1.output) — ([xshift=0.5cm]or1.output) node[above] {};
    \end{tikzpicture}
    `

    `$Y=\overline{A}\cdot\overline{B}\cdot C+\overline{A}\cdot B\cdot\overline{C}+\overline{A}\cdot B\cdot C+A\cdot B\cdot C$}`

    oppure
    `
    \begin{circuitikz} \draw
    (0,0)–(0,4)
    (1,0)–(1,4)
    (0,0) node[anchor=east] {A}
    (1,0) node[anchor=east] {B}
    (5,3.0) node[or port] (myor1) {}

    (0,3.3)to[short, *-] (myor1.in 1)
    (1,2.7)to[short, *-](myor1.in 2)
    (2,1.8) node[not port] (mynot1) {}
    (0,1.8)to[short, *-](mynot1.in)
    (2,0.3) node[not port] (mynot2) {}
    (1,0.3)to[short, *-](mynot2.in)
    (5,1.1) node[or port] (myor2) {}
    (mynot1.out)-|(myor2.in 1)
    (mynot2.out)-|(myor2.in 2)
    (7.0,2.0) node[and port] (myand1) {}
    (myor1.out)-|(myand1.in 1)
    (myor2.out)-|(myand1.in 2);
    \end{circuitikz}
    \begin{circuitikz} \draw
    (0,0)–(0,4)
    (1,0)–(1,4)
    (0,0) node[anchor=east] {A}
    (1,0) node[anchor=east] {B}
    (5,3.0) node[and port] (myand1) {}
    (2,3.3) node[not port] (mynot1) {}
    (5,1.1) node[and port] (myand2) {}
    (2,0.8) node[not port] (mynot2) {}
    (7.0,2.0) node[or port] (myor1) {}
    (0,3.3)to[short, *-] (mynot1.in)
    (mynot1.out)–(myand1.in 1)
    (1,2.7)to[short, *-](myand1.in 2)
    (0,3.3)to[short, *-](mynot1.in)
    (1,0.8)to[short, *-](mynot2.in)
    (0,1.4)to[short, *-](myand2.in 1)
    (mynot2.out)–(myand2.in 2)
    (myand1.out)-|(myor1.in 1)
    (myand2.out)-|(myor1.in 2);
    \end{circuitikz}
    \caption[]{Circuiti corrispondenti a $(A+B)\cdot(\overline{A}+\overline{B})=A\cdot\overline{B}+\overline{A}\cdot B$}
    \label{Tab:circuito2e3}
    \end{table}
    \begin{table} %[H]
    \begin{circuitikz} \draw
    (0,0)–(0,4)
    (1,0)–(1,4)
    (0,0) node[anchor=east] {A}
    (1,0) node[anchor=east] {B}
    (5,3.0) node[and port] (myand1) {}

    (0,3.3)to[short, *-] (myand1.in 1)
    (1,2.7)to[short, *-](myand1.in 2)
    (2,1.8) node[not port] (mynot1) {}
    (0,1.8)to[short, *-](mynot1.in)
    (2,0.3) node[not port] (mynot2) {}
    (1,0.3)to[short, *-](mynot2.in)
    (5,1.1) node[and port] (myand2) {}
    (mynot1.out)-|(myand2.in 1)
    (mynot2.out)-|(myand2.in 2)
    (7.0,2.0) node[or port] (myor1) {}
    (myand1.out)-|(myor1.in 1)
    (myand2.out)-|(myor1.in 2);
    \end{circuitikz}
    \begin{circuitikz} \draw
    (0,0)–(0,4)
    (1,0)–(1,4)
    (0,0) node[anchor=east] {A}
    (1,0) node[anchor=east] {B}
    (5,3.0) node[or port] (myor1) {}
    (2,3.3) node[not port] (mynot1) {}
    (5,1.1) node[or port] (myor2) {}
    (2,0.8) node[not port] (mynot2) {}
    (7.0,2.0) node[and port] (myand1) {}
    (0,3.3)to[short, *-] (mynot1.in)
    (mynot1.out)–(myor1.in 1)
    (1,2.7)to[short, *-](myor1.in 2)
    (0,3.3)to[short, *-](mynot1.in)
    (1,0.8)to[short, *-](mynot2.in)
    (0,1.4)to[short, *-](myor2.in 1)
    (mynot2.out)–(myand2.in 2)
    (myor1.out)-|(myand1.in 1)
    (myor2.out)-|(myand1.in 2);
    \end{circuitikz}
    `
    `
    $(A+B)\cdot(\overline{A}+\overline{B})=A\cdot\overline{B}+\overline{A}\cdot B$}
    \label{Tab:circuito2e3
    `

    Sono due circuiti molto semplici, l’unica nota è che sono stati disegnati in due modi diversi utilizzando infatti due librerie diverse

    Go to top