[pstricks] adding noise to a signal
jmpapy
Jean-Michel.Papy at esat.kuleuven.ac.be
Thu Oct 7 15:17:17 CEST 2004
yes very good !!
I did not know the existence of a postscript pseudo-random generator.
However, this sequence seems to be drawn from a uniform distribution.
I'll try to transform it into a normal distribution, it should not be so
difficult ;-)
thanks again Herbert
JM
Quoting Herbert Voss <Herbert.Voss at alumni.TU-Berlin.DE>:
> jmpapy wrote:
>
> > does anybody knows how to generate a realization of a normally
> > distributed random variable b(n) and to add it to an existing
> > discrete-time signal s(n) drawn using pstricks ?
>
> something like this??
>
> Herbert
>
> \documentclass[a4paper,10pt]{article}
> \usepackage{pstricks,pstricks-add}
> \begin{document}
>
> \pstVerb{
> rrand srand % initializes the random generator
> }
> \begin{pspicture}(-5,-0.2)(5,5)
> \psline{-}(-5,0)(5,0)
> \psplot[linecolor=red,plotpoints=50,showpoints=true,linestyle=none]
{-1}{3}{%
> 4.7 39.48 x 1 neg add 2 exp mul 1 2 exp add div
> rand % a random integer 0...2^31 - 1
> 2147483647 % 2^31 - 1
> div add % now rand is between 0...1
> }
> \end{pspicture}
>
> \vspace{1cm}
> \begin{pspicture}(-5,-0.2)(5,5)
> \psline{-}(-5,0)(5,0)
> \psplot[linecolor=red,plotpoints=50,showpoints=true,linestyle=none]
{-1}{3}{%
> 4.7 39.48 x 1 neg add 2 exp mul 1 2 exp add div
> rand 2147483647 div add %
> }
> \end{pspicture}
>
> \end{document}
>
>
>
> --
> http://TeXnik.de/
> http://PSTricks.de/
> ftp://ftp.dante.de/tex-archive/info/math/voss/Voss-Mathmode.pdf
> http://www.dante.de/faq/de-tex-faq/
> http://www.tex.ac.uk/cgi-bin/texfaq2html?introduction=yes
>
> _______________________________________________
> pstricks mailing list
> pstricks at tug.org
> http://tug.org/mailman/listinfo/pstricks
>
More information about the PSTricks
mailing list