5

Could someone help me with my code to play this image in Latex?

enter image description here

\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}

4 Answers 4

7

Adaptations:

  • Give the box a name: (fl) (filtro linear) and use it for relative positioning
  • use location (fl.north) to write V(B) above the box.
  • write the node right after the connection (see my answer here) instead of [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}

enter image description here

4

slightly different approach in drawing (and looks out) :-)

enter image description here

with use of libraries arrows.meta and quotes (if you not like arrows on input and output, just omit \draw option):

\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}
3

Almost the same as dexteritas except that the lines are really 4cm long.

\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}

enter image description here

3

A try with MetaPost and it boxes package, for whom it may interest. Included in a LuaLaTeX program.

\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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.