summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pstricks/voss/bsp310.tex
blob: b67eaf723840100a88b491289fe79668997a58fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
\documentclass{minimal}
\usepackage{pstricks}
\usepackage{pst-plot}
\usepackage{multido}
\usepackage{pst-xkey}

\makeatletter
\pst@addfams{user}
\define@key[psset]{user}{nLoop}{\def\psnLoop{#1}}
\psset[user]{nLoop=1}
\makeatother
\def\chooseColor#1{%
  \ifcase#1\or red\or green\or blue\or cyan\or magenta\or gray\fi}

\parindent=0pt
\pagestyle{empty}
\begin{document}

\psset{xunit=1.5mm,yunit=3mm}
\begin{pspicture}(-45,0)(45,20)
  \psaxes[Dy=10,Dx=15]{->}(0,0)(-45,0)(45,20)%
  \psset{linewidth=1pt}%
  \pstVerb{%
     /dc 0.2 def
     /kx 12 def
     /ky 12 def
     /pi 3.141529 def
     /rad2deg { 57.296 mul } def
     /si { pi mul dup rad2deg sin exch div } def
     /Func {
       /nLoop exch def
       x kx mul nLoop mul cos
       nLoop dc mul si mul            
     } def
  }%
  \psset{plotpoints=400,linecolor=red,plotstyle=curve}%
  \multido{\iA=1+1}{6}{%
    \psplot[linecolor=\chooseColor\iA,nLoop=\iA]{-45}{45}{%
      /y0 x kx mul cos dc si mul def
      /y1 0 def
      1 1 \psnLoop {
        Func y1 add /y1 exch def
      } for
      y1 y0 add 
      dc mul 2 mul
      dc add
      ky mul
    }%
  }%
\end{pspicture}

\end{document}