Zeichnen eines Blocks mit einer Eingabeleitung und einer Ausgabeleitung mit Tikz

Zeichnen eines Blocks mit einer Eingabeleitung und einer Ausgabeleitung mit Tikz

Kann mir jemand mit meinem Code helfen, um dieses Bild in Latex abzuspielen?

Bildbeschreibung hier eingeben

\begin{tikzpicture}

\draw [-] (0, 0) -- (4, 0) node [pos = .5, above] {$X_t$} node [pos = .5, below] {série de entrada};
\node (rectangle) [draw, rectangle, minimum width = 3 cm, minimum height = 3 cm] {filtro linear} node (Y) {} node [pos = .5, above] {$V(B)$};
\draw [-] (0, 0) -- (4, 0) node [pos = .5, above] {$Y_t$} node [pos = .5, below] {série de saída};

\end{tikzpicture}

Antwort1

Anpassungen:

  • Geben Sie der Box einen Namen: (fl)(filtro linear) und verwenden Sie ihn für die relative Positionierung
  • Verwenden Sie den Standort, (fl.north)um V(B)über das Feld zu schreiben.
  • schreibe den Knoten direkt nach der Verbindung (siehe meineAntwort hier) anstatt[pos = .5]

Code:

\documentclass[border=5pt]{standalone}

\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}
\node[draw, rectangle, minimum width = 3 cm, minimum height = 2 cm] (fl) at (0,0) {filtro linear};
\node[above] at (fl.north) {$V(B)$};
\draw[-] (fl) -- node[above]{$X_t$} node[below]{série de entrada} ++(-4,0);
\draw[-] (fl) -- node[above]{$Y_t$} node[below]{série de saída} ++(4,0);
\end{tikzpicture}

\end{document}

Bildbeschreibung hier eingeben

Antwort2

etwas anderer Ansatz beim Zeichnen (und Aussehen) :-)

Bildbeschreibung hier eingeben

mit Verwendung von Bibliotheken arrows.metaund quotes(wenn Sie keine Pfeile bei Ein- und Ausgabe mögen, lassen Sie \drawdie Option einfach weg):

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta, quotes}

\begin{document}
    \begin{tikzpicture}[auto,
box/.style = {draw, minimum width=3cm, minimum height=2cm}
                        ]
\node [box,label=$V(B)$]  (fl) {filtro linear};
\draw [Triangle-] (fl.west) to ["$X_t$" ', "série de entrada"] + (-4,0);
\draw [-Triangle] (fl.east) to ["$Y_t$",   "série de saída" '] + ( 4,0);
    \end{tikzpicture}
\end{document}

Antwort3

Fast dasselbe wie Dexteritas, außer dass die Linien tatsächlich 4 cm lang sind.

\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}

\begin{tikzpicture}

\node (rectangle) [draw, rectangle, minimum width = 3 cm, minimum
height = 3 cm] (Y) at (4,0) {filtro linear} ;
\draw [-] (Y.west) -- ++ (-4, 0) node [pos = .5, above] {$X_t$} node [pos = .5, below]
{série de entrada};
\node [above=0.1cm of Y,anchor=south] {$V(B)$};
\draw [-]  (Y.east) -- ++ (4, 0) node [pos = .5, above] {$Y_t$} node [pos = .5, below] {série de saída};

\end{tikzpicture}
\end{document}

Bildbeschreibung hier eingeben

Antwort4

Ein Versuch mit MetaPost und seinem boxesPaket, für wen es interessant sein könnte. In einem LuaLaTeX-Programm enthalten.

\documentclass[border=5mm]{standalone}
\usepackage{luatex85, luamplib}
\begin{document}
\begin{mplibcode}
    input boxes;
    beginfig(1);
        boxit.f(btex filtro linear etex);
        f.w = (4cm, 0); pair extr; extr = f.e + f.w; 
        f.e - f.w = (3cm, 0); f.n - f.s = (0, 2cm);
        drawboxed(f);
        draw origin -- f.w; draw f.e -- extr;
        label.top(btex $V(B)$ etex, .5[f.nw,f.ne]);
        label.top(btex $X_t$ etex, .5[origin,f.w]);
        label.bot(btex série de entrada etex, .5[origin,f.w]);
        label.top(btex $Y_t$ etex, .5[f.e,extr]);
        label.bot(btex série de saída etex, .5[f.e,extr]);
    endfig;
\end{mplibcode}
\end{document}

Bildbeschreibung hier eingeben

verwandte Informationen