[pstricks] Trellis diagrams

Carsten Vogel texnicer at web.de
Sun Jan 30 08:31:18 CET 2011


Am 29.01.2011 22:25, schrieb Per Ting:
> trellis diagrams for convolutional codes

At least the generic use of pst-node.
(Herbert do not hit me for this abuse of code ;)

What I did: http://imagebin.org/135137
Where I learned of Trellis: http://en.wikipedia.org/wiki/Convolutional_code

My Code (hints/suggestions) welcome!

\documentclass[svgnames]{scrartcl}
\usepackage{pst-node}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\newpsstyle{trellis}{nodesepA=6mm,nodesepB=4mm,arrows=->}

\newcommand{\enco}[2][LightGray]{%
	\psframe[fillstyle=solid,fillcolor=#1](-.5,-.5)(.5,.5)%
	\rput(0,0){#2\strut}%
}

\newcommand{\gen}[2][270]{%
	\pscircle(0,0){.3}%
	\psline(-.3,0)(.3,0)%
	\psline(0,-.3)(0,.3)%
	\rput(.5;#1){\footnotesize #2}
}

\begin{document}
\SpecialCoor
\begin{pspicture}(0,-3)(6,3)
\rput(0,0){\pnode{org}{}}
\rput(2,0){\pnode{m1}}
\rput(3,0){\pnode{m0}}
\rput(4,0){\pnode{mx1}}

\rput(3,2){\pnode{g111}}
\rput(4,-1.3){\pnode{g011}}
\rput(2.5,-2.2){\pnode{g101}}

\rput(6,2){\pnode{n1}}
\rput(6,-1.3){\pnode{n2}}
\rput(6,-2.2){\pnode{n3}}

\rput(m1){\enco[white]{$m_1$}}
\rput(m0){\enco{$m_0$}}
\rput(mx1){\enco{$m_{-1}$}}

\rput(g111){\gen[90]{$(1,1,1)$}}
\rput(g011){\gen{$(0,1,1)$}}
\rput(g101){\gen{$(1,0,1)$}}

\rput(n1){$n_1$}
\rput(n2){$n_2$}
\rput(n3){$n_3$}

\ncline[nodesepA=4mm,nodesepB=6mm,arrows=->]{org}{m1}

\ncline[style=trellis]{m1}{g111}
\ncline[style=trellis]{m0}{g111}
\ncline[style=trellis]{mx1}{g111}

\ncline[style=trellis]{m0}{g011}
\ncline[style=trellis]{mx1}{g011}

\ncline[style=trellis]{m1}{g101}
\ncline[style=trellis]{mx1}{g101}

\ncline[style=trellis]{g111}{n1}
\ncline[style=trellis]{g011}{n2}
\ncline[style=trellis]{g101}{n3}
\end{pspicture}
\end{document}



More information about the PSTricks mailing list