[pstricks] digital signals with \listplot]

Herbert Voss Herbert.Voss at alumni.TU-Berlin.DE
Fri Aug 8 14:37:03 CEST 2003


Goebel, Juergen, ISO31 schrieb:

 > 
http://www.lnt.e-technik.tu-muenchen.de/mitarbeiter/stockhammer/lehre/ntp/di
 > g.html
 >
 > In the first figure there is an analog signal printed in blue
 > and the corresponding digital signal printed in red. The end
 > marks of the digital signal (here circles) should be variable,
 > e.g. with the parameters dotsize, dotstyle or so.

ok, first try. I run it with a datafile which is nonsense
for that what you need, but this is not important.

Herbert

\documentclass[12pt,a4paper]{article}
\usepackage{pst-plot}

\makeatletter
\def\psset at step#1{\edef\psk at step{#1}}
\psset at step{1}
\pst at def{ScalePoints}<%
    /y ED /x ED
    counttomark dup dup cvi eq not { exch pop } if
    /m exch def /n m 2 div cvi def /nDiff \psk at step\space def /ncount 1 def
    n { ncount nDiff mod 0 eq {
          y mul m 1 roll x mul m 1 roll }{ y mul pop x mul pop } ifelse
       /m m 2 sub def /ncount ncount 1 add def
    } repeat>
\let\beginplot at LineToXAxis\beginplot at line
\def\endplot at LineToXAxis{\psLineToXAxis at ii}
\let\beginqp at LineToXAxis\beginqp at line
\let\doqp at LineToXAxis\doqp at line
\let\endqp at LineToXAxis\endqp at line
\let\testqp at LineToXAxis\testqp at line
%
\def\psLineToXAxis at ii{%
\addto at pscode{\pst at cp \psline at iii \tx at LineToXAxis}%
\end at OpenObj}
%
\def\tx at LineToXAxis{LineToXAxis }
%
% Adapted from Line
\pst at def{LineToXAxis}<{%
NArray
n 0 eq not
    { n 1 eq { 0 0 /n 2 def } if
      ArrowA
      /n n 2 sub def
      CP 2 copy moveto pop 0 Lineto
      n { 2 copy moveto pop 0 Lineto } repeat
      CP
      4 2 roll
      ArrowB
      2 copy moveto pop 0
      L
      pop pop } if}>
\makeatother

\begin{document}
\readdata{\data}{data.dat}
\psset{xunit=0.15mm,yunit=0.0003mm}
\begin{pspicture}(1000,300000)
\psaxes[axesstyle=frame,Dx=100,dx=100,%
	Dy=50000,dy=50000](1000,300000)
\listplot[% 		the vertical lines
	step=50,%       only every 50th data record
	linecolor=red,%
	plotstyle=LineToXAxis,%
      showpoints=true,%
      dotstyle=x,%
      dotsize=0.5]{\data}
\listplot[%         the "real" curve
	linewidth=1pt,%
	linecolor=blue]{\data}
\end{pspicture}

\end{document}


-- 
http://www.pstricks.de/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: data.dat
Url: http://tug.org/pipermail/pstricks/attachments/20030808/bbf17163/attachment.pl 


More information about the PSTricks mailing list