[pstricks] Trellis diagrams

Per Ting perting at gmail.com
Sun Jan 30 16:58:57 CET 2011


Thanks! I will try it.

Per

On Sun, Jan 30, 2011 at 3:37 AM, Carsten Vogel <texnicer at web.de> wrote:

> Am 29.01.2011 22:25, schrieb Per Ting:
>
>> Is there an easy way to plot the trellis diagrams for convolutional
>> codes using PStricks?
>>
>
> Okay, some minor changes, now I think it's acceptable:
>
> http://imagebin.org/135142
>
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> \documentclass[svgnames]{scrartcl}
> \usepackage{pst-node}
> \usepackage[T1]{fontenc}
> \usepackage{lmodern}
> \usepackage{multido}
>
> % provides replicate
>
> \def\recur#1{\csname rn#1\recur} \long\def\rnm#1{\endcsname{#1}#1}
> \long\def\rn#1{}
> \def\replicate#1{\csname rn\expandafter\recur
>  \romannumeral\number\number#1 000\endcsname\endcsname}
>
> % provides guess what: a box!
>
> \newcommand{\trbox}[1][00]{\psframebox{#1}}
>
> % provides linestyles
>
> \newpsstyle{tre}{arrows=->,nodesep=.2em,linecolor=Gray}
> \newpsstyle{tdashed}{linestyle=dashed}
> \newpsstyle{marked}{linecolor=Crimson,linewidth=2pt,nodesep=.2em,arrows=->}
>
>
>
> \begin{document}
> %\begin{pspicture}(-.8,-1)(8.8,3.8)
> %\psframe[linecolor=Gray,linewidth=.7pt](-.8,-1)(8.8,3.8)
>
> \begin{psmatrix}[colsep=3em,rowsep=1em]
>        \replicate{4}{\trbox &}\trbox\\
>        \replicate{4}{\trbox[01] &}\trbox[01]\\
>        \replicate{4}{\trbox[10] &}\trbox[10]\\
>        \replicate{4}{\trbox[11] &}\trbox[11]\\
> \end{psmatrix}
>
> \multido{\na=1+1,\nb=2+1}{4}{%
>        \ncline[style=tre]{1,\na}{1,\nb}
>        \ncline[style=tre]{2,\na}{1,\nb}
>        \ncline[style=tre]{3,\na}{2,\nb}
>        \ncline[style=tre]{4,\na}{2,\nb}
>        \ncline[style=tre,style=tdashed]{1,\na}{3,\nb}
>        \ncline[style=tre,style=tdashed]{2,\na}{3,\nb}
>        \ncline[style=tre,style=tdashed]{3,\na}{4,\nb}
>        \ncline[style=tre,style=tdashed]{4,\na}{4,\nb}
> }
>        % check: line to  {[3|4],X} needs style=tdashed
>
>        \ncline[style=marked]{1,1}{1,2}
>        \ncline[style=marked,style=tdashed]{1,2}{3,3}
>
>        \ncline[style=marked]{3,3}{2,4}
>        \ncline[style=marked,style=tdashed]{2,4}{3,5}
> %\end{pspicture}
>
> \end{document}
> _______________________________________________
> PSTricks mailing list
> PSTricks at tug.org
> http://tug.org/mailman/listinfo/pstricks
> archive: http://www.tug.org/pipermail/pstricks/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/pstricks/attachments/20110130/59228e4f/attachment.html>


More information about the PSTricks mailing list