How do I create the dotted box? For the rest of the diagram I used a matrix, but I'm having trouble creating that box. Here's the code I used.

$ x(n)$\rightarrow \boxed{T} \rightarrow \boxed{[ \hspace{0.25 cm}]^2} \rightarrow &\bigoplus& \rightarrow T[x(n)]$ $\\
$$&\uparrow&$ $\\
$$& 7&$
$ \end{matrix} $

2 Answers 2


Two approaches:

enter image description here

  1. The first one uses your code (slightly modified) and the tikzmark library from TikZ to place some marks in the diagram; those marks are then used to draw the dashed box (the document needs to be processed twice to stabilize).

  2. The whole diagram is drawn using TikZ; I used a chain, but other approaches are possible, of course. Then the fit library was used to draw the dashed box.

The code:



 x(n)\rightarrow\tikzmark{start}\boxed{T} \rightarrow \boxed{[ \hspace{0.25 cm}]^2} \rightarrow & \bigotimes\tikzmark{end} & \rightarrow T[x(n)] \\
&\uparrow& \\
& 7&

\begin{tikzpicture}[remember picture,overlay]
  ([shift={(-8pt,-1cm)}]pic cs:start) 
  ([shift={(15pt,0.7cm)}]pic cs:end); 

  start chain,
  every join/.style={->},
  shorten >= 5pt,
  shorten <= 5pt,
  node distance=0.8cm and 0.8cm
\node[on chain,join] {$x(n)$};
\node[draw,on chain,join] (T) {$T$};
\node[draw,on chain,join] {$[\hspace{0.25 cm}]^2$}; 
\node[draw,circle,on chain,join] (otimes) {$\times$};
\node[on chain,join] {$T[x(n)]$};
\node[below=of otimes] (seven) {$7$};
\draw[->] (seven) -- (otimes); 
\node[draw,inner xsep=12pt,dashed,fit={(T) (otimes) (seven)}] {};


TiKZ, of course, is a better solution:

enter image description here

Here I use a simple approach with positioning library to automatically place your figure elements. To create the dashed box, fit library again is the best choice.


\begin{tikzpicture}[>=latex',node distance=.7cm]
\node(xn) {$x(n)$};
\node(bt) [right=of xn,draw]{$T$};
\node(sq) [right=of bt,draw]{$[\hspace{0.25cm}]^2$};
\node(ot) [circle,draw,right=of sq,inner sep=0pt]{$\times$};
\node(tx) [right=of ot]{$T[x(n)]$};
\node(sv) [below=of ot,outer sep=0pt]{7};
\node[draw,inner sep=7pt,dashed,fit={(bt) (ot) (sv)}] {};


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .