# Encoder Diagram

I am trying to create an Encoder block diagram.

Can someone provide me the starting point? Regards

TikZ solution:

\documentclass[tikz, border=3mm]{standalone}
\usetikzlibrary{arrows.meta, calc, chains, positioning}
\newcommand\ppbb{path picture bounding box}

\makeatletter
\tikzset{suppress join/.code={\def\tikz@after@path{}}}
\makeatother

\begin{document}
\begin{tikzpicture}[
> = Triangle,
node distance = 7mm,
start chain = going right,
box/.style = {draw, minimum size=7mm, on chain, join=by ->},
dot/.style = {circle, draw, fill, minimum size=1mm, inner sep=0mm,
on chain, join=by -, node contents={}},
sum/.style = {circle, draw, minimum size=6mm,
path picture={\draw[thick,shorten <=1.5mm,shorten >=1.5mm,-]
(\ppbb.north) edge (\ppbb.south)
(\ppbb.west)  edge (\ppbb.east);
},% end of path picture /node content/
node contents={}},
]
\coordinate[on chain, label=left:{$X[n]$}] (in);
\node (n1) [dot];
\node (n2) [box] {$z^{-1}$};
\node (n3) [dot];
\node (n4) [box] {$z^{-1}$};
\node (n5) [dot];
\node (n6) [box,suppress join] {$\&$};
\coordinate[on chain, join=by ->,label=right:{$Y[n]$}] (out);
%
\node (s1) [sum,above=of n2.north -| n3];
\node (s2) [sum,above=of n2.north -| n5];
%
\node (s3) [sum,below=of n2.south -| n3];
\node (s4) [sum,below=of n2.south -| n5];
%
\draw[->]   (n1)  |-  (s1);
\draw[->]   (s1) edge (s2)
(s2)  -|  node[right] {$Y_1[n]$} (n6)
(n3) edge (s1)
(n5) edge (s2);
%
\draw[->]   (n1)  |-  (s3);
\draw[->]   (s3) edge (s4)
(s4) -| node[right] {$Y_2[n]$} (n6)
(n3) edge (s3)
(n5) edge (s4);
\end{tikzpicture}%
\end{document}


Here is a short code with pstricks. It can be compiled with pdflatex, provided you launch the compiler with --enable-write18 switch for MiKTeX, -shell-escape for TeX Live and MacTeX.

\documentclass[border=3pt]{standalone}
\usepackage{amsmath}

\usepackage{pst-node, auto-pst-pdf}

\begin{document}

$\def\pscolhookii{\hskip-.4cm} \psset{emnode=p} \begin{psmatrix}[rowsep=1cm, colsep=1.2cm, emnode=p]%[, rowsep=0.8cm] %% nodes & & & \circlenode{+A}{+} & & \circlenode{+C}{+} & \\ X[n] & & \fbox{$Z⁻¹$\strut} & & \fbox{$Z⁻¹$\strut} & & \fbox{\&\rule[-2.5ex]{0pt}{6ex}} & [name=Y]Y_{\text{out}} \\ & & & & & \circlenode{+B}{+} & %%lines and arrows \psset{arrowinset=0.15, nodesep=0pt, linewidth=0.6pt} \ncline[arrows=->]{2,1}{2,3} \ncline{2,3}{2,5} \ncline[arrows=->]{2,7}{Y} \ncangle[angleB=90]{2,5}{+B}\ncangle[angleB=-90]{2,5}{+C}% \ncline{+A}{+C} \ncangle[angleA=-90, angleB=180]{+A}{+B} \ncbar[arrows=<->, armA=7cm, angleA=180, angleB=180]{+B}{+A} \ncline{2,7}{1,7} \ncline{2,7}{3,7} \psset{arrows=->, nodesepB =-0.4pt} \ncline{+C} {1,7}\ncline{+B}{3,7} \nput{0}{1,7}{Y_\textrm{out.1}} \nput{0}{3,7}{Y_\textrm{out.2}} \end{psmatrix}%$

\end{document}


• (+1) for the effort. little modification is needed though. The sum in the bottom sums two inputs. – CroCo Jul 16 '17 at 23:13
• @Croco: Oh! yes. I hadn't noticed this detail. With a second arrow tip I guess? – Bernard Jul 16 '17 at 23:20
• The Yout.2 is the output of two inputs (i.e. Yout.2 = input1 + input2). The output of the second Z^{-1} (i.e. in the center and say it is A) is added to X[n] (i.e. Yout.2 = X[n] + A ). Also the case for the right top sum needs to acquire input from Z{-1} (i.e. A). – CroCo Jul 16 '17 at 23:24
• @Croco: I've modifrd the code. Is it what you want now? – Bernard Jul 16 '17 at 23:40
• Not me but the OP wants that. Also, there should be no connection from the bottom to the top left sum. :) – CroCo Jul 16 '17 at 23:44