SlideShare una empresa de Scribd logo
Insertando figuras con PSTricks

      Digna Gonz´lez Otero
                a

        11 de julio de 2010




                1
´
                                                            Indice general

´
Indice general                                                                                                          2

1 Gr´ficas sencillas con PSTricks
     a                                                                                                                   3
  1.1. Introducci´n . . . . . . . . . .
                 o                          .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    3
  1.2. Primeros dibujos . . . . . . .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    3
  1.3. Pol´
          ıgonos . . . . . . . . . . .      .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    5
  1.4. Dibujando curvas . . . . . . .       .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .    8
  1.5. Ejes de coordenadas . . . . .        .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   10

2 Funciones y fuentes de        datos                                                                                   13
  2.1. Dibujar funciones . .    . . . . . . . . . . . . . . . . . . . . . . . .                                         13
  2.2. Dibujar ejes . . . . .   . . . . . . . . . . . . . . . . . . . . . . . .                                         14
  2.3. Dibujando datos . .      . . . . . . . . . . . . . . . . . . . . . . . .                                         15

3 Efectos especiales                                                                                                    17
  3.1. Hacer zoom en gr´ficos . . . . . . . . . . . . . . . . . . . . . . .
                       a                                                                                                17

4 Dibujando ´rboles
              a                                                                                                         19
       ´
  4.1. Arboles simples . . . . . . . . . . . . . . . . . . . . . . . . . . .                                            19

5 Ejemplos pr´cticos
              a                                                                                                         21
  5.1. Diagrama de bloques . . . . . . . . . . . . . . . . . . . . . . . .                                              21




                                        2
Cap´
                                                                         ıtulo    1

            Gr´ficas sencillas con PSTricks
              a


1.1.    Introducci´n
                  o

Este documento es un breve resumen de las posibilidades que ofrece PSTricks.
Para m´s informaci´n, consultar las presentaciones creadas por el TUG (TeX
       a          o
User Group) de India o el manual completo de PSTricks, para informaci´n m´s
                                                                     o    a
     ıfica.1
espec´


1.2.    Primeros dibujos

Cajas para dibujos

Por defecto no se reserva espacio para los dibujos, y ´stos podr´ sobreescribir
                                                      e         ıan
el texto. Para solucionar esto tenemos que usar el entorno pspicture, que crea
una caja del tama˜o que le indiquemos. El tama˜o se indica a trav´s de las
                    n                               n                 e
coordenadas de las esquinas inferior izquierda y superior derecha, como se ve
en el siguiente ejemplo.
        begin { pspicture } ( − 0 . 5 , 0 ) ( 2 . 5 , 1 )
                 psdots ( 0 , 0 ) ( 2 , 0 ) ( 1 , 1 )
        end { pspicture }




Dibujando puntos

El objeto m´s sencillo que podemos dibujar es un punto.
           a
   1 Documentos   en: http://www.tug.org/PSTricks/main.cgi?file=doc/docs


                                                  3
4                      CAP´          ´
                          ITULO 1. GRAFICAS SENCILLAS CON PSTRICKS


Comando: psdots(x,y), siendo x e y las coordenadas respecto al punto actual
de TeX y la unidad por defecto 1cm.
          psdots ( 1 , 0 )


Dibujo un punto:
Con un unico comando se pueden dibujar varios puntos, de la siguiente forma:
       ´
psdots(x1,y1)(x2,y2)(x3,y3)...(xn,yn).
          begin { pspicture } ( − 0 . 5 , 0 ) ( 2 . 5 , 1 )
                   psdots ( 0 , 0 ) ( 2 , 0 ) ( 1 , 1 )
          end { pspicture }




Podemos cambiar los puntos redondos por otros cuadrados usando la opci´n
                                                                      o
dotstyle.
          begin { pspicture } ( − 0 . 5 , 0 ) ( 2 . 5 , 1 )
                   psdots [ dotstyle=square ] ( 0 , 0 ) ( 2 , 0 ) ( 1 , 1 )
          end { pspicture }




Dibujando l´
           ıneas

Comando psline. Se le pasan las coordenadas del punto origen y el destino.
 begin { pspicture } ( 0 , 0 ) ( 3 . 5 , 2 . 5 )
          psline ( 2 , 1 ) ( 3 , 2 )
 end { pspicture }




Se puede cambiar el tipo de l´
                             ınea con la opci´n linestyle, por ejemplo,
                                             o
dashed o dotted.
 begin { pspicture } ( 0 , 0 ) ( 2 , 1 )
          psline ( 0 , 0 ) ( 2 , 0 )
          psline [ linestyle=dashed ] ( 2 , 0 ) ( 1 , 1 )
          psline [ linestyle=dotted ] ( 1 , 1 ) ( 0 , 0 )
 end { pspicture }
1.3. POL´
        IGONOS                                                                        5




Terminaci´n de l´
         o      ıneas

Se pude terminar una l´
                      ınea con una punta de flecha, usando el par´metro
                                                                a
arrows.
        begin { center }
                 begin { pspicture } ( 0 , − 0 . 5 ) ( 2 , 2 . 5 )
                          psline [ arrows = − >](0 ,0) ( 1 , 2 )
                          psline [ arrows =<−>](1,1) ( 2 , 1 )
                 end { pspicture }
        end { center }




1.3.    Pol´
           ıgonos

L´
 ıneas poligonales abiertas

Con un unico comando psline podemos dibujar m´ltiples l´
       ´                                      u         ıneas.
        begin { center }
                 begin { pspicture } ( 0 , 0 ) ( 5 , 2 )
                          psline ( 1 , 1 ) ( 2 , 2 ) ( 3 , 1 ) ( 4 , 2 ) ( 5 , 1 )
                 end { pspicture }
        end { center }




Esquinas redondeadas

Si queremos que las esquinas sean redondeadas, podemos usar el par´metro
                                                                  a
linearc, que indica el radio del arco dibujado por las esquinas.
6                        CAP´          ´
                            ITULO 1. GRAFICAS SENCILLAS CON PSTRICKS


 begin { center }
          begin { pspicture } ( 0 , 0 ) ( 5 , 2 )
                   psline [ linearc = 0 . 2 5 ] %
                  (1 ,1) (2 ,2) (3 ,1) (4 ,2) (5 ,1)
          end { pspicture }
 end { center }




Pol´
   ıgonos

Para dibujar un pol´
                   ıgono el primer y el ultimo punto tienen que coincidir.
                                        ´
 begin { center }
          begin { pspicture } ( 0 , 0 ) ( 5 , 3 )
                   psline ( 1 , 1 ) ( 2 , 2 ) ( 5 , 2 ) ( 4 , 1 ) ( 1 , 1 )
          end { pspicture }
 end { center }




Tambi´n podemos usar el comando pspolygon, en cuyo caso no es necesario
       e
repetir el ultimo punto.
           ´
 begin { center }
          begin { pspicture } ( 0 , 0 ) ( 5 , 3 )
                   pspolygon ( 1 , 1 ) ( 2 , 2 ) ( 5 , 2 ) ( 4 , 1 )
          end { pspicture }
 end { center }
1.3. POL´
        IGONOS                                                              7


La versi´n con estrella del comando polygon (pspolygon*) dibuja un pol´
         o                                                             ıgono
relleno.
El comando psframe dibuja un rect´ngulo. Para ello le tenemos que pasar
                                        a
las coordenadas de las esquinas inferior izquierda y superior derecha. Tambi´n
                                                                            e
tiene una versi´n con estrella que rellena el rect´ngulo.
               o                                  a

 begin { center }
          begin { pspicture } ( 0 , 0 ) ( 6 , 4 )
                   psframe ( 1 , 1 ) ( 3 , 3 )
                   psframe ∗ ( 1 , 1 ) ( 2 , 2 )
                   psframe ∗ ( 2 , 2 ) ( 3 , 3 )
          end { pspicture }
 end { center }




En este ejemplo dibujamos un cuadrado mayor y dentro, dos cuadrados m´s
                                                                     a
peque˜os sombreados.
     n
Para redondear las esquinas del rect´ngulo podemos usar la opci´n framearc.
                                    a                          o
Si hacemos que framearc=n, el radio de las esquinas ser´ n veces la anchura o
                                                       a
altura del rect´ngulo, tomando la dimensi´n menor.
               a                          o

 begin { center }
          begin { pspicture } ( − 0 . 5 , 0 . 5 ) ( 5 . 5 , 3 . 5 )
                   psframe [ framearc = 0 . 5 ] ( 0 , 0 ) ( 5 , 3 )
                   psframe [ framearc = 0 . 5 ] ( 1 , 1 ) ( 4 , 2 )
          end { pspicture }
 end { center }
8                  CAP´          ´
                      ITULO 1. GRAFICAS SENCILLAS CON PSTRICKS


1.4.    Dibujando curvas

Podemos generar curvas que pasen por determinados puntos.



Curvas abiertas

Comando pscurve, an´logo a psline.
                    a

 begin { pspicture } ( 0 , 0 ) ( 5 , 5 )
          pscurve [ linecolor=Blue ] %
         (2 ,1) (1 ,2) (2 ,4) %
         (2.5 ,2) (4 ,4) (3.5 ,2.5)
 end { pspicture }




Podemos marcar los puntos por los que pasa la curva con la opci´n showpoints.
                                                               o

 begin { pspicture } ( 0 , 0 ) ( 5 , 5 )
          pscurve [ linecolor=Blue , showpoints=true ] %
         (2 ,1) (1 ,2) (2 ,4) %
         (2.5 ,2) (4 ,4) (3.5 ,2.5)
 end { pspicture }
1.4. DIBUJANDO CURVAS                                                 9


Curvas cerradas

Se pueden dibujar curvas cerradas con el comando psccurve.

 begin { pspicture } ( 0 , 0 ) ( 5 , 5 )
          psccurve [ linecolor=Blue ] %
         (2 ,1) (1 ,2) (2 ,4) %
         (2.5 ,2) (4 ,4) (3.5 ,2.5)
 end { pspicture }




Finales invisibles

El comando psecurve dibuja una curva pasando por los puntos indicados
excepto por los extremos. Los puntos extremos se usan para determinar la
forma de la curva, aunque no se muestren en el dibujo.

 begin { pspicture } ( 0 , 0 ) ( 5 , 5 )
          psecurve [ linecolor=Blue ] %
         (2 ,1) (1 ,2) (2 ,4) %
         (2.5 ,2) (4 ,4) (3.5 ,2.5)
 end { pspicture }
10                    CAP´          ´
                             ITULO 1. GRAFICAS SENCILLAS CON PSTRICKS


    1.5.      Ejes de coordenadas

    El comando psgrid dibuja una rejilla con los ejes de coordenadas del tama˜ o
                                                                             n
    del cuadro de la figura.
     begin { pspicture } ( 0 , 0 ) ( 5 , 5 )
              psgrid
     end { pspicture }

5

4

3

2

1

0
     0    1     2      3     4       5
    Podemos definir las caracter´
                               ısticas de la rejilla usando la versi´n extendida del
                                                                    o
    comando: psgrid(x0,y0 )(x1 ,y1 )(x2 ,y2 ).
    (x1 ,y1 ) e (x2 ,y2 son las esquinas opuestas de la rejilla, y (x0 ,y0 ) define la posi-
    ci´n de los n´meros referentes a los ejes de coordenadas.
      o             u
    Mediante las opciones del comando podemos configurar el aspecto de la rejilla.
    Por ejemplo, para cambiar los colores, gridcolor, subgridcolor y gridlabelcolor
     begin { pspicture } ( 0 , 0 ) ( 3 , 3 )
              psgrid [ gridcolor=Peach , s u b g r i d c o l o r=Apricot , g r i d l a b e l c o l o r←
                  =Red ] ( 0 , 0 ) ( 3 , 3 )
     end { pspicture }

3

2

1

0
    0        1       2        3

    Cambiando la escala

    La unidad por defecto de PSTricks es de 1 cm. Esto se puede cambiar con la
    opci´n unit, como se ve en el siguiente ejemplo.
        o
     begin { pspicture } ( 0 , 0 ) ( 2 , 2 )
1.5. EJES DE COORDENADAS                                                                            11


              psgrid [ gridcolor=Blue , s u b g r i d c o l o r=Blue , g r i d l a b e l c o l o r=←
                  Blue ] ( 0 , 0 ) ( 2 , 1 )
     end { pspicture }
     hspace {2 cm }
     begin { pspicture } ( 0 , 0 ) ( 2 , 2 )
              psgrid [ unit=2cm , gridcolor=Red , s u b g r i d c o l o r=Red , ←
                  g r i d l a b e l c o l o r=Red ] ( 0 , 0 ) ( 2 , 1 )
     end { pspicture }

                                     1

1

0                                    0
    0        1       2                   0               1                2


    Esta opci´n se puede usar para escalar una figura. Tambi´n se puede usar una
              o                                              e
    escala diferente para cada eje usando las opciones xunit e yunit.
     begin { pspicture } ( 0 , 0 ) ( 3 , 2 )
              pspolygon [ linecolor=Blue ] ( 0 , 0 ) ( 2 , 0 ) ( 1 , 1 )
     end { pspicture }
     hspace {2 cm }
     begin { pspicture } ( 0 , 0 ) ( 3 , 2 )
              pspolygon [ xunit =1.5 cm , yunit =0.5 cm , linecolor=Red ] ( 0 , 0 ) ←
                  (2 ,0) (1 ,1)
     end { pspicture }




    NOTA: El radio de una circunferencia no se escala con xunit ni con yunit,
    sino que utiliza una escala especial, determinada por runit.
Pstricks resumen
Cap´
                                                                                 ıtulo          2

                     Funciones y fuentes de datos


     2.1.    Dibujar funciones

     Adem´s de dibujar curvas que pasen por puntos concretos, podemos dibu-
           a
     jarlas a partir de una funci´n. Para ello hay que usar el paquete pst-plot
                                 o
     (usepackage{pst-plot}).
     En el siguiente ejemplo se muestra c´mo dibujar la ecuaci´n y = x3 − x para
                                         o                    o
     -1.5≤x≤1.5.
      begin { pspicture }( −2 , −3) ( 2 , 3 )
               psgrid [ gridcolor=Apricot , g r i d l a b e l c o l o r=Mahogany , ←
                   s u b g r i d c o l o r=Apricot ]
               psplot [ plotstyle=curve , linecolor=Blue ] { − 1 . 5 } { 1 . 5 } { x 3 exp ←
                   x sub }
      end { pspicture }

3

2

1

0

-1

-2

-3
      -2    -1     0    1     2
     Como se ve en el ejemplo, el c´digo PostScript para representar la funci´n
                                   o                                          o
     y = x3 − x es x 3 exp x sub. En general, hay que expresar y como funci´n de
                                                                           o

                                               13
14                      CAP´
                                ITULO 2. FUNCIONES Y FUENTES DE DATOS


     x.
     Comando: psplot{min x}{max x}{ecuacion}.



     Funciones param´tricas
                    e

     Si las ecuaciones est´n expresadas de forma param´trica, como en el siguiente
                          a                           e
     ejemplo, podemos dibujarlas con el comando parametricplot.


                                                    t
                                            x=
                                                  1 + t2


                                                    t3
                                            y=
                                                  1 + t2

      begin { pspicture }( −2 , −2) ( 2 , 2 )
               psgrid [ gridcolor=Apricot , g r i d l a b e l c o l o r=Mahogany , ←
                      s u b g r i d c o l o r=Apricot ] ( −2 , −2) ( 2 , 2 )
               p a r a m e t r i c p l o t [ plotstyle=curve , linecolor=Blue ]{ −2}{2} %
              { t t 2 exp 1 add div t 3 exp t 2 exp 1 add div }
      end { pspicture }

2

1

0

-1

-2
     -2      -1      0      1         2


     2.2.     Dibujar ejes

     El comando psaxes nos permite dibujar ejes de coordenadas.
     psaxes(x0, y0 )(x1 , y1 )(x2 , y2 )


     (x0 , y0 ) origen de los ejes.

     (x1 , y1 ) valores inferiores de x e y.

     (x2 , y2 ) valores superiores de x e y.
2.3. DIBUJANDO DATOS                                                   15


2.3.   Dibujando datos

Cuando queremos dibujar curvas a partir de una serie de datos generada por
otros programas, podemos utilizar algunos comandos proporcionados por el
paquete pst-plot, como fileplot, para leer datos de archivos externos.
El archivo externo debe contener en cada l´
                                          ınea un par de coordenadas entre
par´ntesis, sin unidades.
   e
Otro comando a utilizar es readdata.


fileplot[parametros]{nombreArchivo}
Pstricks resumen
Cap´
                                                                         ıtulo    3

                                                    Efectos especiales


3.1.      Hacer zoom en gr´ficos
                          a

Mediante el comando psclip se puede conseguir el efecto de hacer zoom en
una funci´n, como se muestra en el siguiente ejemplo.
         o
Es importante recalcar que no se est´ haciendo zoom de forma autom´tica, sino
                                    a                               a
que hay que redibujar la se˜al en el segundo c´
                            n                   ırculo para conseguir el efecto
deseado.
 newcomman d { plotsqsin }{ %
        psplot [ plotpoint s =500 , plotstyle=curve     , linecolor=Blue ] %
       {0}{6.2832} %
       { 5 7 . 2 9 5 8 x mul sin 2 exp }}
 newcomman d { plotabssin }{ %
        psplot [ plotpoint s =500 , plotstyle=curve     , linecolor=Green ] %
       {0}{6.2832} %
       { 5 7 . 2 9 5 8 x mul sin abs }}
 newcomman d { plotsqsinp }{ %
        psplot [ plotpoint s =500 , plotstyle=curve     , linecolor=Blue ] %
       { −6.2832}{6.2832} %
       { 5 7 . 2 9 5 8 x mul sin 2 exp }}
 newcomman d { plotabssi n p }{ %
        psplot [ plotpoint s =500 , plotstyle=curve     , linecolor=Green ] %
       { −6.2832}{6.2832} %
       { 5 7 . 2 9 5 8 x mul sin abs }}

 definecol or { PaleYellow }{ cmyk } { 0 , 0 , 0 . 2 , 0 }
 newpsobje ct { ycirc }{ pscircle }{ fillstyle=solid , fillcolor=←
     PaleYellow }
 newpsobje ct { dotline }{ psline }{ linestyle=dotted , dotsep=1pt }
 newpsobje ct { coloraxes }{ psaxes } %
{ linestyle=solid , linecolor=Apricot , labels=none , ticks=none }

 psset { unit = 0 . 6 6 , linecolor=Red }


 begin { pspicture }(0 , −7) ( 6 . 5 , 2 )
         coloraxes ( 0 , 0 ) (0 , −2) ( 7 , 2 )
         plotsqsin


                                                   17
18                                        CAP´
                                             ITULO 3. EFECTOS ESPECIALES


          plotabssi n
          psclip { ycirc ( 3 . 1 4 1 6 , 0 ) { 0 . 5 } }
          coloraxes ( 0 , 0 ) (0 , −2) ( 7 , 2 )
          plotsqsin
          plotabssi n
          endpsclip
          dotline ( 2 . 6 4 1 6 , 0 ) ( 1 . 1 4 1 6 , − 4 )
          dotline ( 3 . 6 4 1 6 , 0 ) (5 . 1 4 1 6 5 , − 4 )
          psclip { ycirc ( 3 . 1 4 1 6 , − 4 ) {2}}
          psset { origin ={3.1416 , −4} , unit =1.33 cm }
          coloraxes ( 0 , 0 ) ( −2 , −2) ( 7 , 2 )
          plotsqsin p
          plotabssi n p
          endpsclip
 end { pspicture }
Cap´
                                                                     ıtulo       4

                                            Dibujando ´rboles
                                                      a

Los ´rboles son una forma sencilla de dibujar ciertos tipos de diagramas, evi-
    a
tando tener que dibujar las l´
                             ıneas y las cajas de forma manual.
Para usar estos comandos hay que incluir el paquete pst-tree.


4.1.     ´
         Arboles simples

Un ´rbol simple est´ compuesto por un elemento origen y varios elementos
    a              a
hijos.
 begin { center }
          color { Blue }
          psset { linecolor=Red , nodesep =2pt }
          pstree { Tr { root }}
         { Tr { terminal } Tr { terminal } Tr { terminal }}
 end { center }




                                          root




                        terminal        terminal       terminal

Tambi´n podemos tener ´rboles con elementos anidados:
     e                a
 begin { center }
         color { Blue }
         psset { linecolor=Red , nodesep =2pt }
         pstree { Tr { root }}
        { Tr { terminal }
                  pstree { Tr { subroot }}
                 { Tr { subtermin a l } Tr { subtermin al }}
                  Tr { terminal }}


                                           19
20                             CAP´                  ´
                                  ITULO 4. DIBUJANDO ARBOLES


 end { center }




                                   root




                   terminal   subroot          terminal




                     subterminal          subterminal
Cap´
                                                                                           ıtulo       5

                                                           Ejemplos pr´cticos
                                                                      a


5.1.        Diagrama de bloques

 begin { pspicture } ( 4 , 0 ) ( 2 4 , 2 . 5 )
 psset { arrowinset =0 , arrowleng t h =1.5}
% p s g r i d [ s u b g r i d w i d t h =.2 pt , s u b g r i d c o l o r=b l a c k ]
  


 psline [ linewidth =1pt ]{ − >}( −0.2 ,1) ( 0 . 6 , 1 )
 rput [ b ] ( 0 . 1 , 1 . 1 ) { small $ mathbf { u ( t ) }$}
% % % % % % % %l%c k %1 % % % % % % % % % % % % % % % % % % %
  %                    b o%
 rput ( 0 . 6 , 1 ) {           pspolygon [ linewidth =1pt ] ( 0 , 1 . 5 ) ( 2 , 1 . 5 ) (2 , −1)←
     (0 , −1)
          psline [ linewidth =1pt ] ( 0 , 1 ) ( 2 , 1 )
          rput [ b ] ( 1 , 1 . 1 5 ) { scriptsiz e  textsf { BLOCK 1}}
          rput ( 1 , 0 ) { psframebox ∗ [ framesep =1pt ] {  scriptsiz e
         { begin { minipage } { 1 . 8 cm } center  textsf { INPUT VOLTAGE ←
                 ADAPTER } end { minipage }}}}}

 psline [ linewidth =1pt ] { − > } (2 . 6 , 1 ) ( 3 . 8 , 1 )
 rput [ b ] ( 3 . 1 5 , 1 . 1 ) { small $ mathbf { u { 1 } ( t ) }$}

% % % % % % % %l%c k %2 % % % % % % % % % % % % % % % % % % %
  %                    b o%
 rput ( 3 . 8 , 1 ) {           pspolygon [ linewidth =1pt ] ( 0 , 1 . 5 ) ( 2 , 1 . 5 ) (2 , −1)←
     (0 , −1)
 psline [ linewidth =1pt ] ( 0 , 1 ) ( 2 , 1 )
 rput [ b ] ( 1 , 1 . 1 5 ) { scriptsiz e  textsf { BLOCK 2}}
 rput ( 1 , 0 ) { psframebox ∗ [ framesep =1pt ] {  scriptsiz e
{ begin { minipage } { 1 . 8 cm } center  textsf { DEMODUL . SQUARING ←
     MULTIPLIER } end { minipage }}}}}

 psline [ linewidth =1pt ] { − > } (5 . 8 , 1 ) ( 7 , 1 )
 rput [ b ] ( 6 . 3 5 , 1 . 1 ) { small $ mathbf { u { 2 } ( t ) }$}

% % % % % % % %l%c k %3 % % % % % % % % % % % % % % % % % % %
  %                    b o%
 rput ( 7 , 1 ) {  pspolygon [ linewidth =1pt ] ( 0 , 1 . 5 ) ( 6 , 1 . 5 ) (6 , −1) (0 , −1)
 psline [ linewidth =1pt ] ( 0 , 1 ) ( 6 , 1 )
 rput [ b ] ( 3 , 1 . 1 5 ) { scriptsiz e  textsf { BLOCK 3}}
 rput ( 0 . 5 , − 0 . 3 ) {
 pspolygon ( − 0 . 1 5 , − 0 . 2 5 ) ( − 0 . 1 5 , 1 . 1 ) ( 1 . 4 , 1 . 1 ) ( 1 . 4 , − 0 . 2 5 )
 psline [ linewidth =0.5 pt ] ( 0 , 0 ) ( 0 , 1 )


                                                           21
22                                                 CAP´                   ´
                                                      ITULO 5. EJEMPLOS PRACTICOS


 psline [ linewidth =0.5 pt ] ( 0 , 0 ) ( 1 . 2 5 , 0 )
 pscurve [ linewidth =0.5 pt ] ( 0 , 0 ) ( 0 . 1 , 0 . 7 ) ( 0 . 2 , 0 . 8 ) ( 0 . 6 , 0 . 8 5 ) ( 1 , 0 . 8 ) ←
     (1.1 ,0.7) (1.2 ,0)
 psline [ linestyle=dotted , dotsep =0.5 pt , linewidth =0.25 pt ] ( 0 . 1 , 0 ) ←
     (0.1 ,0.7)
 psline [ linestyle=dotted , dotsep =0.5 pt , linewidth =0.25 pt ] ( 1 . 1 , 0 ) ←
     (1.1 ,0.7)
 rput [ b ] ( 0 . 1 , − 0 . 2 ) { tiny 0 . 0 5 }
 rput [ b ] ( 1 . 1 , − 0 . 2 ) { tiny 35}}

 rput ( 2 . 5 , − 0 . 3 ) {
          pspolygon ( − 0 . 1 5 , − 0 . 2 5 ) ( − 0 . 1 5 , 1 . 1 ) ( 1 . 4 , 1 . 1 ) ( 1 . 4 , − 0 . 2 5 )
          psline [ linewidth =0.5 pt ] ( 0 , 0 ) ( 0 , 1 )
          psline [ linewidth =0.5 pt ] ( 0 , 0 ) ( 1 . 2 5 , 0 )
          pscurve [ linewidth =0.5 pt ]
         (0 ,0) (0. 05 , 0. 16) (0. 15 , 0. 32) (0. 25 , 0. 48) (0. 325 , 0. 64)←
                 (0.35 ,0.72) (0.44 ,0.8)
         (0.55 ,0.72) (0.6 ,0.64) (0.725 ,0.48) (0.925 ,0.32) (1.3 ,0.16)
          psline [ linestyle=dotted , dotsep =0.5 pt , linewidth =0.25 pt←
                 ](0.44 ,0) (0.44 ,0.8)
          rput [ b ] ( 0 . 4 4 , − 0 . 2 ) { tiny 8 . 8 } }

 rput ( 5 , 0 ) { psframebox ∗ [ framesep =1pt ] {  scriptsiz e
{ begin { minipage } { 1 . 5 cm } center  textsf { RANGE SELECTOR } end {←
     minipage }}}}

 rput [ b ] ( 3 , − 0 . 9 ) { scriptsize  textsf { DEMODUL . AND WEIGHTING ←
     FILTERS }}}

 psline [ linewidth =1pt ]{ − >}(13 ,1) ( 1 4 . 2 , 1 )
 rput [ b ] ( 1 3 . 5 5 , 1 . 1 ) { small $ mathbf { u { 3 } ( t ) }$}
 rput [ b ] ( 1 3 . 5 5 , 0 . 6 ) { small $ mathbf { P { { lin }}}$}


% % % % % % % %l%c k %4 % % % % % % % % % % % % % % % % % % %
  %                    b o%
 rput ( 1 4 . 2 , 1 ) {         pspolygon [ linewidth =1pt ] ( 0 , 1 . 5 ) ( 2 , 1 . 5 ) (2 , −1)←
     (0 , −1)
 psline [ linewidth =1pt ] ( 0 , 1 ) ( 2 , 1 )
 rput [ b ] ( 1 , 1 . 1 5 ) { scriptsize  textsf { BLOCK 4}}
 rput ( 1 , 0 ) { psframebox ∗ [ framesep =1pt ] {  scriptsiz e
{ begin { minipage } { 1 . 8 cm } center  textsf { SQUARING MULTIPLIE R +←
     SLIDING MEAN FILTER } end { minipage }}}}}

 psline [ linewidth =1pt ] { − > } (1 6 . 2 , 1 ) ( 1 7 . 4 , 1 )
 rput [ b ] ( 1 6 . 7 5 , 1 . 1 ) { small $ mathbf { u { 4 } ( t ) }$}
 rput [ b ] ( 1 6 . 7 5 , 0 . 6 ) { small $ mathbf { P { { inst }}}$}


% % % % % % % %l%c k %5 % % % % % % % % % % % % % % % % % % %
  %                    b o%
 rput ( 1 7 . 4 , 1 ) {         pspolygon [ linewidth =1pt ] ( 0 , 1 . 5 ) ( 2 , 1 . 5 ) (2 , −1)←
     (0 , −1)
 psline [ linewidth =1pt ] ( 0 , 1 ) ( 2 , 1 )
 rput [ b ] ( 1 , 1 . 1 5 ) { scriptsize  textsf { BLOCK 5}}
 rput ( 1 , 0 ) { psframebox ∗ [ framesep =1pt ] {  scriptsiz e
{ begin { minipage } { 1 . 8 cm } center  textsf { STATISTIC A L EVALUATIO N }←
     end { minipage }}}}}

 psline [ linewidth =1pt ] { − > } (1 9 . 4 , 1 ) ( 2 0 , 1 )
 rput [ b ] ( 2 0 , 1 . 1 ) { small $ mathbf { P { { st }}}$}
 end { pspicture }
5.1. DIAGRAMA DE BLOQUES                                                      23


    BLOCK 1             BLOCK 2                           BLOCK 3                          BLOCK 4                  BLOCK 5

                                                                                           SQUARING
)    INPUT    u1 (t)   DEMODUL.     u2 (t)                              RANGE    u3 (t)   MULTIPLIER      u4 (t)   STATISTICAL   Pst
    VOLTAGE            SQUARING                                                                +
                                                                      SELECTOR   Plin                     Pinst    EVALUATION
    ADAPTER            MULTIPLIER                                                           SLIDING
                                             0.05   35      8.8
                                                                                          MEAN FILTER
                                               DEMODUL. AND WEIGHTING FILTERS

Más contenido relacionado

DOC
Corrigés exercices langage C
DOC
Pvr du président en matiere de police administrative
PDF
Désignation des matériaux métalliques
PDF
Câle réglable (corrigé)
PDF
Fstm deust mip-e141_cee_chap_vii_le transistor bipolaire
PPT
Lamini&farsane traitement de_signale
PDF
Norton thevenin
PPTX
Aplicación de la integral definida
Corrigés exercices langage C
Pvr du président en matiere de police administrative
Désignation des matériaux métalliques
Câle réglable (corrigé)
Fstm deust mip-e141_cee_chap_vii_le transistor bipolaire
Lamini&farsane traitement de_signale
Norton thevenin
Aplicación de la integral definida

La actualidad más candente (20)

PDF
Chevalier _guide_du_technicien_en_productique
PDF
Rappel de cours traitement de signal
PDF
Liaisons mécaniques
PDF
Cour traitement du signal.pdf
PDF
Cours Transformée de Laplace.pdf
PPTX
Etude et simulation d’un système Automatisée sur le Réseaux Informatique
PDF
correction examen rattrapage 2012 transmission numérique
PDF
Traitement de signal 1
PDF
Cours moulage
PDF
rapport stage OCP : Elaboration plan des machines : La machine stockeuse et ...
PDF
Tome 1 vibrations
PPTX
Serie de Fourier
DOCX
Rapport de stage
PDF
Exercices corrigés les matrices- djeddi kamel
DOC
Chapitre cotation dimensionnelle
PDF
Chimie de polymère
PDF
PDF
logique combinatoire
PPTX
Correction des exercices du thème 6 du manuel du cours 3ème année
PDF
les filtres analogiques.pdf
Chevalier _guide_du_technicien_en_productique
Rappel de cours traitement de signal
Liaisons mécaniques
Cour traitement du signal.pdf
Cours Transformée de Laplace.pdf
Etude et simulation d’un système Automatisée sur le Réseaux Informatique
correction examen rattrapage 2012 transmission numérique
Traitement de signal 1
Cours moulage
rapport stage OCP : Elaboration plan des machines : La machine stockeuse et ...
Tome 1 vibrations
Serie de Fourier
Rapport de stage
Exercices corrigés les matrices- djeddi kamel
Chapitre cotation dimensionnelle
Chimie de polymère
logique combinatoire
Correction des exercices du thème 6 du manuel du cours 3ème année
les filtres analogiques.pdf
Publicidad

Similar a Pstricks resumen (20)

PDF
Pst solides3d
PDF
PDF
Disenograficoenlatex1
PDF
Fractales.minimonograph
PDF
Tutorial_Mathematica.pdf
PDF
Zoom de una imagen
PDF
Tutorial mathematica
PDF
Minilaboratori resta enteros
PDF
Vba excel numericos
PDF
Vba excel mnumericos
PDF
Vba excel mnumericos1
PDF
Como crear planos
PDF
Complex
PDF
Funciones
PDF
Tesis Licenciatura
PDF
Solución de ecuaciones diferenciales - AERO.pdf
PDF
Guia_Analisis_Exp.pdf
PDF
39661139-Manual-AutoLisp.pdf
PDF
39661139-Manual-AutoLisp.pdf
PDF
39661139-Manual-AutoLisp.pdf
Pst solides3d
Disenograficoenlatex1
Fractales.minimonograph
Tutorial_Mathematica.pdf
Zoom de una imagen
Tutorial mathematica
Minilaboratori resta enteros
Vba excel numericos
Vba excel mnumericos
Vba excel mnumericos1
Como crear planos
Complex
Funciones
Tesis Licenciatura
Solución de ecuaciones diferenciales - AERO.pdf
Guia_Analisis_Exp.pdf
39661139-Manual-AutoLisp.pdf
39661139-Manual-AutoLisp.pdf
39661139-Manual-AutoLisp.pdf
Publicidad

Más de Digna González (20)

PDF
Visualizacion de Imagen Médica con 3D Slicer
PDF
Poster ECG y RCP (reanimación cardiopulmonar)
PDF
Otras herramientas
PDF
Introduccion TIC y video corporativo
PDF
Ehusfera: Blogosfera de la UPV/EHU
PDF
Licencias Creative Commons
PDF
Otros servicios UPV/EHU
PDF
Difusion contenidos UPV
PDF
Albergue disco UPV/EHU
PDF
Elkarlan
PDF
TIC: introduccion
PDF
Filtros caf
PDF
Amplificadores caf
PDF
LaTeX (Euskara)
PDF
LaTeX: Glossaries
PDF
PDF
5-beamer: Creación de presentaciones con LaTeX Imprimible
PDF
5-Beamer: Creación de presentaciones con LaTeX
PDF
Truquillos LaTeX
PDF
4-Zotero
Visualizacion de Imagen Médica con 3D Slicer
Poster ECG y RCP (reanimación cardiopulmonar)
Otras herramientas
Introduccion TIC y video corporativo
Ehusfera: Blogosfera de la UPV/EHU
Licencias Creative Commons
Otros servicios UPV/EHU
Difusion contenidos UPV
Albergue disco UPV/EHU
Elkarlan
TIC: introduccion
Filtros caf
Amplificadores caf
LaTeX (Euskara)
LaTeX: Glossaries
5-beamer: Creación de presentaciones con LaTeX Imprimible
5-Beamer: Creación de presentaciones con LaTeX
Truquillos LaTeX
4-Zotero

Último (20)

DOCX
Trabajo grupal.docxjsjsjsksjsjsskksjsjsjsj
PPTX
unidad 3 tecnología 8° básico: planificación y elaboración de un objeto
PPTX
la-historia-de-la-medicina Edna Silva.pptx
PPTX
modulo seguimiento 1 para iniciantes del
PDF
Diapositiva proyecto de vida, materia catedra
PPTX
Acronis Cyber Protect Cloud para Ciber Proteccion y Ciber Seguridad LATAM - A...
PPTX
Presentacion de Alba Curso Auditores Internos ISO 19011
PDF
Documental Beyond the Code (Dossier Presentación - 2.0)
PPTX
ccna: redes de nat ipv4 stharlling cande
DOCX
TRABAJO GRUPAL (5) (1).docxjsjsjskskksksk
PDF
MANUAL TECNOLOGÍA SER MINISTERIO EDUCACIÓN
PDF
TRABAJO DE TECNOLOGIA.pdf...........................
PDF
ADMINISTRACIÓN DE ARCHIVOS - TICS (SENA).pdf
PPTX
CLAASIFICACIÓN DE LOS ROBOTS POR UTILIDAD
PDF
Instrucciones simples, respuestas poderosas. La fórmula del prompt perfecto.
PDF
CONTABILIDAD Y TRIBUTACION, EJERCICIO PRACTICO
PDF
Distribucion de frecuencia exel (1).pdf
PPTX
El uso de las TIC en la vida cotidiana..
DOCX
TRABAJO GRUPAL (5) (1).docxjesjssjsjjskss
PPTX
Sesion 1 de microsoft power point - Clase 1
Trabajo grupal.docxjsjsjsksjsjsskksjsjsjsj
unidad 3 tecnología 8° básico: planificación y elaboración de un objeto
la-historia-de-la-medicina Edna Silva.pptx
modulo seguimiento 1 para iniciantes del
Diapositiva proyecto de vida, materia catedra
Acronis Cyber Protect Cloud para Ciber Proteccion y Ciber Seguridad LATAM - A...
Presentacion de Alba Curso Auditores Internos ISO 19011
Documental Beyond the Code (Dossier Presentación - 2.0)
ccna: redes de nat ipv4 stharlling cande
TRABAJO GRUPAL (5) (1).docxjsjsjskskksksk
MANUAL TECNOLOGÍA SER MINISTERIO EDUCACIÓN
TRABAJO DE TECNOLOGIA.pdf...........................
ADMINISTRACIÓN DE ARCHIVOS - TICS (SENA).pdf
CLAASIFICACIÓN DE LOS ROBOTS POR UTILIDAD
Instrucciones simples, respuestas poderosas. La fórmula del prompt perfecto.
CONTABILIDAD Y TRIBUTACION, EJERCICIO PRACTICO
Distribucion de frecuencia exel (1).pdf
El uso de las TIC en la vida cotidiana..
TRABAJO GRUPAL (5) (1).docxjesjssjsjjskss
Sesion 1 de microsoft power point - Clase 1

Pstricks resumen

  • 1. Insertando figuras con PSTricks Digna Gonz´lez Otero a 11 de julio de 2010 1
  • 2. ´ Indice general ´ Indice general 2 1 Gr´ficas sencillas con PSTricks a 3 1.1. Introducci´n . . . . . . . . . . o . . . . . . . . . . . . . . . . . . . 3 1.2. Primeros dibujos . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.3. Pol´ ıgonos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.4. Dibujando curvas . . . . . . . . . . . . . . . . . . . . . . . . . . 8 1.5. Ejes de coordenadas . . . . . . . . . . . . . . . . . . . . . . . . 10 2 Funciones y fuentes de datos 13 2.1. Dibujar funciones . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.2. Dibujar ejes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.3. Dibujando datos . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3 Efectos especiales 17 3.1. Hacer zoom en gr´ficos . . . . . . . . . . . . . . . . . . . . . . . a 17 4 Dibujando ´rboles a 19 ´ 4.1. Arboles simples . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 5 Ejemplos pr´cticos a 21 5.1. Diagrama de bloques . . . . . . . . . . . . . . . . . . . . . . . . 21 2
  • 3. Cap´ ıtulo 1 Gr´ficas sencillas con PSTricks a 1.1. Introducci´n o Este documento es un breve resumen de las posibilidades que ofrece PSTricks. Para m´s informaci´n, consultar las presentaciones creadas por el TUG (TeX a o User Group) de India o el manual completo de PSTricks, para informaci´n m´s o a ıfica.1 espec´ 1.2. Primeros dibujos Cajas para dibujos Por defecto no se reserva espacio para los dibujos, y ´stos podr´ sobreescribir e ıan el texto. Para solucionar esto tenemos que usar el entorno pspicture, que crea una caja del tama˜o que le indiquemos. El tama˜o se indica a trav´s de las n n e coordenadas de las esquinas inferior izquierda y superior derecha, como se ve en el siguiente ejemplo. begin { pspicture } ( − 0 . 5 , 0 ) ( 2 . 5 , 1 ) psdots ( 0 , 0 ) ( 2 , 0 ) ( 1 , 1 ) end { pspicture } Dibujando puntos El objeto m´s sencillo que podemos dibujar es un punto. a 1 Documentos en: http://www.tug.org/PSTricks/main.cgi?file=doc/docs 3
  • 4. 4 CAP´ ´ ITULO 1. GRAFICAS SENCILLAS CON PSTRICKS Comando: psdots(x,y), siendo x e y las coordenadas respecto al punto actual de TeX y la unidad por defecto 1cm. psdots ( 1 , 0 ) Dibujo un punto: Con un unico comando se pueden dibujar varios puntos, de la siguiente forma: ´ psdots(x1,y1)(x2,y2)(x3,y3)...(xn,yn). begin { pspicture } ( − 0 . 5 , 0 ) ( 2 . 5 , 1 ) psdots ( 0 , 0 ) ( 2 , 0 ) ( 1 , 1 ) end { pspicture } Podemos cambiar los puntos redondos por otros cuadrados usando la opci´n o dotstyle. begin { pspicture } ( − 0 . 5 , 0 ) ( 2 . 5 , 1 ) psdots [ dotstyle=square ] ( 0 , 0 ) ( 2 , 0 ) ( 1 , 1 ) end { pspicture } Dibujando l´ ıneas Comando psline. Se le pasan las coordenadas del punto origen y el destino. begin { pspicture } ( 0 , 0 ) ( 3 . 5 , 2 . 5 ) psline ( 2 , 1 ) ( 3 , 2 ) end { pspicture } Se puede cambiar el tipo de l´ ınea con la opci´n linestyle, por ejemplo, o dashed o dotted. begin { pspicture } ( 0 , 0 ) ( 2 , 1 ) psline ( 0 , 0 ) ( 2 , 0 ) psline [ linestyle=dashed ] ( 2 , 0 ) ( 1 , 1 ) psline [ linestyle=dotted ] ( 1 , 1 ) ( 0 , 0 ) end { pspicture }
  • 5. 1.3. POL´ IGONOS 5 Terminaci´n de l´ o ıneas Se pude terminar una l´ ınea con una punta de flecha, usando el par´metro a arrows. begin { center } begin { pspicture } ( 0 , − 0 . 5 ) ( 2 , 2 . 5 ) psline [ arrows = − >](0 ,0) ( 1 , 2 ) psline [ arrows =<−>](1,1) ( 2 , 1 ) end { pspicture } end { center } 1.3. Pol´ ıgonos L´ ıneas poligonales abiertas Con un unico comando psline podemos dibujar m´ltiples l´ ´ u ıneas. begin { center } begin { pspicture } ( 0 , 0 ) ( 5 , 2 ) psline ( 1 , 1 ) ( 2 , 2 ) ( 3 , 1 ) ( 4 , 2 ) ( 5 , 1 ) end { pspicture } end { center } Esquinas redondeadas Si queremos que las esquinas sean redondeadas, podemos usar el par´metro a linearc, que indica el radio del arco dibujado por las esquinas.
  • 6. 6 CAP´ ´ ITULO 1. GRAFICAS SENCILLAS CON PSTRICKS begin { center } begin { pspicture } ( 0 , 0 ) ( 5 , 2 ) psline [ linearc = 0 . 2 5 ] % (1 ,1) (2 ,2) (3 ,1) (4 ,2) (5 ,1) end { pspicture } end { center } Pol´ ıgonos Para dibujar un pol´ ıgono el primer y el ultimo punto tienen que coincidir. ´ begin { center } begin { pspicture } ( 0 , 0 ) ( 5 , 3 ) psline ( 1 , 1 ) ( 2 , 2 ) ( 5 , 2 ) ( 4 , 1 ) ( 1 , 1 ) end { pspicture } end { center } Tambi´n podemos usar el comando pspolygon, en cuyo caso no es necesario e repetir el ultimo punto. ´ begin { center } begin { pspicture } ( 0 , 0 ) ( 5 , 3 ) pspolygon ( 1 , 1 ) ( 2 , 2 ) ( 5 , 2 ) ( 4 , 1 ) end { pspicture } end { center }
  • 7. 1.3. POL´ IGONOS 7 La versi´n con estrella del comando polygon (pspolygon*) dibuja un pol´ o ıgono relleno. El comando psframe dibuja un rect´ngulo. Para ello le tenemos que pasar a las coordenadas de las esquinas inferior izquierda y superior derecha. Tambi´n e tiene una versi´n con estrella que rellena el rect´ngulo. o a begin { center } begin { pspicture } ( 0 , 0 ) ( 6 , 4 ) psframe ( 1 , 1 ) ( 3 , 3 ) psframe ∗ ( 1 , 1 ) ( 2 , 2 ) psframe ∗ ( 2 , 2 ) ( 3 , 3 ) end { pspicture } end { center } En este ejemplo dibujamos un cuadrado mayor y dentro, dos cuadrados m´s a peque˜os sombreados. n Para redondear las esquinas del rect´ngulo podemos usar la opci´n framearc. a o Si hacemos que framearc=n, el radio de las esquinas ser´ n veces la anchura o a altura del rect´ngulo, tomando la dimensi´n menor. a o begin { center } begin { pspicture } ( − 0 . 5 , 0 . 5 ) ( 5 . 5 , 3 . 5 ) psframe [ framearc = 0 . 5 ] ( 0 , 0 ) ( 5 , 3 ) psframe [ framearc = 0 . 5 ] ( 1 , 1 ) ( 4 , 2 ) end { pspicture } end { center }
  • 8. 8 CAP´ ´ ITULO 1. GRAFICAS SENCILLAS CON PSTRICKS 1.4. Dibujando curvas Podemos generar curvas que pasen por determinados puntos. Curvas abiertas Comando pscurve, an´logo a psline. a begin { pspicture } ( 0 , 0 ) ( 5 , 5 ) pscurve [ linecolor=Blue ] % (2 ,1) (1 ,2) (2 ,4) % (2.5 ,2) (4 ,4) (3.5 ,2.5) end { pspicture } Podemos marcar los puntos por los que pasa la curva con la opci´n showpoints. o begin { pspicture } ( 0 , 0 ) ( 5 , 5 ) pscurve [ linecolor=Blue , showpoints=true ] % (2 ,1) (1 ,2) (2 ,4) % (2.5 ,2) (4 ,4) (3.5 ,2.5) end { pspicture }
  • 9. 1.4. DIBUJANDO CURVAS 9 Curvas cerradas Se pueden dibujar curvas cerradas con el comando psccurve. begin { pspicture } ( 0 , 0 ) ( 5 , 5 ) psccurve [ linecolor=Blue ] % (2 ,1) (1 ,2) (2 ,4) % (2.5 ,2) (4 ,4) (3.5 ,2.5) end { pspicture } Finales invisibles El comando psecurve dibuja una curva pasando por los puntos indicados excepto por los extremos. Los puntos extremos se usan para determinar la forma de la curva, aunque no se muestren en el dibujo. begin { pspicture } ( 0 , 0 ) ( 5 , 5 ) psecurve [ linecolor=Blue ] % (2 ,1) (1 ,2) (2 ,4) % (2.5 ,2) (4 ,4) (3.5 ,2.5) end { pspicture }
  • 10. 10 CAP´ ´ ITULO 1. GRAFICAS SENCILLAS CON PSTRICKS 1.5. Ejes de coordenadas El comando psgrid dibuja una rejilla con los ejes de coordenadas del tama˜ o n del cuadro de la figura. begin { pspicture } ( 0 , 0 ) ( 5 , 5 ) psgrid end { pspicture } 5 4 3 2 1 0 0 1 2 3 4 5 Podemos definir las caracter´ ısticas de la rejilla usando la versi´n extendida del o comando: psgrid(x0,y0 )(x1 ,y1 )(x2 ,y2 ). (x1 ,y1 ) e (x2 ,y2 son las esquinas opuestas de la rejilla, y (x0 ,y0 ) define la posi- ci´n de los n´meros referentes a los ejes de coordenadas. o u Mediante las opciones del comando podemos configurar el aspecto de la rejilla. Por ejemplo, para cambiar los colores, gridcolor, subgridcolor y gridlabelcolor begin { pspicture } ( 0 , 0 ) ( 3 , 3 ) psgrid [ gridcolor=Peach , s u b g r i d c o l o r=Apricot , g r i d l a b e l c o l o r← =Red ] ( 0 , 0 ) ( 3 , 3 ) end { pspicture } 3 2 1 0 0 1 2 3 Cambiando la escala La unidad por defecto de PSTricks es de 1 cm. Esto se puede cambiar con la opci´n unit, como se ve en el siguiente ejemplo. o begin { pspicture } ( 0 , 0 ) ( 2 , 2 )
  • 11. 1.5. EJES DE COORDENADAS 11 psgrid [ gridcolor=Blue , s u b g r i d c o l o r=Blue , g r i d l a b e l c o l o r=← Blue ] ( 0 , 0 ) ( 2 , 1 ) end { pspicture } hspace {2 cm } begin { pspicture } ( 0 , 0 ) ( 2 , 2 ) psgrid [ unit=2cm , gridcolor=Red , s u b g r i d c o l o r=Red , ← g r i d l a b e l c o l o r=Red ] ( 0 , 0 ) ( 2 , 1 ) end { pspicture } 1 1 0 0 0 1 2 0 1 2 Esta opci´n se puede usar para escalar una figura. Tambi´n se puede usar una o e escala diferente para cada eje usando las opciones xunit e yunit. begin { pspicture } ( 0 , 0 ) ( 3 , 2 ) pspolygon [ linecolor=Blue ] ( 0 , 0 ) ( 2 , 0 ) ( 1 , 1 ) end { pspicture } hspace {2 cm } begin { pspicture } ( 0 , 0 ) ( 3 , 2 ) pspolygon [ xunit =1.5 cm , yunit =0.5 cm , linecolor=Red ] ( 0 , 0 ) ← (2 ,0) (1 ,1) end { pspicture } NOTA: El radio de una circunferencia no se escala con xunit ni con yunit, sino que utiliza una escala especial, determinada por runit.
  • 13. Cap´ ıtulo 2 Funciones y fuentes de datos 2.1. Dibujar funciones Adem´s de dibujar curvas que pasen por puntos concretos, podemos dibu- a jarlas a partir de una funci´n. Para ello hay que usar el paquete pst-plot o (usepackage{pst-plot}). En el siguiente ejemplo se muestra c´mo dibujar la ecuaci´n y = x3 − x para o o -1.5≤x≤1.5. begin { pspicture }( −2 , −3) ( 2 , 3 ) psgrid [ gridcolor=Apricot , g r i d l a b e l c o l o r=Mahogany , ← s u b g r i d c o l o r=Apricot ] psplot [ plotstyle=curve , linecolor=Blue ] { − 1 . 5 } { 1 . 5 } { x 3 exp ← x sub } end { pspicture } 3 2 1 0 -1 -2 -3 -2 -1 0 1 2 Como se ve en el ejemplo, el c´digo PostScript para representar la funci´n o o y = x3 − x es x 3 exp x sub. En general, hay que expresar y como funci´n de o 13
  • 14. 14 CAP´ ITULO 2. FUNCIONES Y FUENTES DE DATOS x. Comando: psplot{min x}{max x}{ecuacion}. Funciones param´tricas e Si las ecuaciones est´n expresadas de forma param´trica, como en el siguiente a e ejemplo, podemos dibujarlas con el comando parametricplot. t x= 1 + t2 t3 y= 1 + t2 begin { pspicture }( −2 , −2) ( 2 , 2 ) psgrid [ gridcolor=Apricot , g r i d l a b e l c o l o r=Mahogany , ← s u b g r i d c o l o r=Apricot ] ( −2 , −2) ( 2 , 2 ) p a r a m e t r i c p l o t [ plotstyle=curve , linecolor=Blue ]{ −2}{2} % { t t 2 exp 1 add div t 3 exp t 2 exp 1 add div } end { pspicture } 2 1 0 -1 -2 -2 -1 0 1 2 2.2. Dibujar ejes El comando psaxes nos permite dibujar ejes de coordenadas. psaxes(x0, y0 )(x1 , y1 )(x2 , y2 ) (x0 , y0 ) origen de los ejes. (x1 , y1 ) valores inferiores de x e y. (x2 , y2 ) valores superiores de x e y.
  • 15. 2.3. DIBUJANDO DATOS 15 2.3. Dibujando datos Cuando queremos dibujar curvas a partir de una serie de datos generada por otros programas, podemos utilizar algunos comandos proporcionados por el paquete pst-plot, como fileplot, para leer datos de archivos externos. El archivo externo debe contener en cada l´ ınea un par de coordenadas entre par´ntesis, sin unidades. e Otro comando a utilizar es readdata. fileplot[parametros]{nombreArchivo}
  • 17. Cap´ ıtulo 3 Efectos especiales 3.1. Hacer zoom en gr´ficos a Mediante el comando psclip se puede conseguir el efecto de hacer zoom en una funci´n, como se muestra en el siguiente ejemplo. o Es importante recalcar que no se est´ haciendo zoom de forma autom´tica, sino a a que hay que redibujar la se˜al en el segundo c´ n ırculo para conseguir el efecto deseado. newcomman d { plotsqsin }{ % psplot [ plotpoint s =500 , plotstyle=curve , linecolor=Blue ] % {0}{6.2832} % { 5 7 . 2 9 5 8 x mul sin 2 exp }} newcomman d { plotabssin }{ % psplot [ plotpoint s =500 , plotstyle=curve , linecolor=Green ] % {0}{6.2832} % { 5 7 . 2 9 5 8 x mul sin abs }} newcomman d { plotsqsinp }{ % psplot [ plotpoint s =500 , plotstyle=curve , linecolor=Blue ] % { −6.2832}{6.2832} % { 5 7 . 2 9 5 8 x mul sin 2 exp }} newcomman d { plotabssi n p }{ % psplot [ plotpoint s =500 , plotstyle=curve , linecolor=Green ] % { −6.2832}{6.2832} % { 5 7 . 2 9 5 8 x mul sin abs }} definecol or { PaleYellow }{ cmyk } { 0 , 0 , 0 . 2 , 0 } newpsobje ct { ycirc }{ pscircle }{ fillstyle=solid , fillcolor=← PaleYellow } newpsobje ct { dotline }{ psline }{ linestyle=dotted , dotsep=1pt } newpsobje ct { coloraxes }{ psaxes } % { linestyle=solid , linecolor=Apricot , labels=none , ticks=none } psset { unit = 0 . 6 6 , linecolor=Red } begin { pspicture }(0 , −7) ( 6 . 5 , 2 ) coloraxes ( 0 , 0 ) (0 , −2) ( 7 , 2 ) plotsqsin 17
  • 18. 18 CAP´ ITULO 3. EFECTOS ESPECIALES plotabssi n psclip { ycirc ( 3 . 1 4 1 6 , 0 ) { 0 . 5 } } coloraxes ( 0 , 0 ) (0 , −2) ( 7 , 2 ) plotsqsin plotabssi n endpsclip dotline ( 2 . 6 4 1 6 , 0 ) ( 1 . 1 4 1 6 , − 4 ) dotline ( 3 . 6 4 1 6 , 0 ) (5 . 1 4 1 6 5 , − 4 ) psclip { ycirc ( 3 . 1 4 1 6 , − 4 ) {2}} psset { origin ={3.1416 , −4} , unit =1.33 cm } coloraxes ( 0 , 0 ) ( −2 , −2) ( 7 , 2 ) plotsqsin p plotabssi n p endpsclip end { pspicture }
  • 19. Cap´ ıtulo 4 Dibujando ´rboles a Los ´rboles son una forma sencilla de dibujar ciertos tipos de diagramas, evi- a tando tener que dibujar las l´ ıneas y las cajas de forma manual. Para usar estos comandos hay que incluir el paquete pst-tree. 4.1. ´ Arboles simples Un ´rbol simple est´ compuesto por un elemento origen y varios elementos a a hijos. begin { center } color { Blue } psset { linecolor=Red , nodesep =2pt } pstree { Tr { root }} { Tr { terminal } Tr { terminal } Tr { terminal }} end { center } root terminal terminal terminal Tambi´n podemos tener ´rboles con elementos anidados: e a begin { center } color { Blue } psset { linecolor=Red , nodesep =2pt } pstree { Tr { root }} { Tr { terminal } pstree { Tr { subroot }} { Tr { subtermin a l } Tr { subtermin al }} Tr { terminal }} 19
  • 20. 20 CAP´ ´ ITULO 4. DIBUJANDO ARBOLES end { center } root terminal subroot terminal subterminal subterminal
  • 21. Cap´ ıtulo 5 Ejemplos pr´cticos a 5.1. Diagrama de bloques begin { pspicture } ( 4 , 0 ) ( 2 4 , 2 . 5 ) psset { arrowinset =0 , arrowleng t h =1.5} % p s g r i d [ s u b g r i d w i d t h =.2 pt , s u b g r i d c o l o r=b l a c k ] psline [ linewidth =1pt ]{ − >}( −0.2 ,1) ( 0 . 6 , 1 ) rput [ b ] ( 0 . 1 , 1 . 1 ) { small $ mathbf { u ( t ) }$} % % % % % % % %l%c k %1 % % % % % % % % % % % % % % % % % % % % b o% rput ( 0 . 6 , 1 ) { pspolygon [ linewidth =1pt ] ( 0 , 1 . 5 ) ( 2 , 1 . 5 ) (2 , −1)← (0 , −1) psline [ linewidth =1pt ] ( 0 , 1 ) ( 2 , 1 ) rput [ b ] ( 1 , 1 . 1 5 ) { scriptsiz e textsf { BLOCK 1}} rput ( 1 , 0 ) { psframebox ∗ [ framesep =1pt ] { scriptsiz e { begin { minipage } { 1 . 8 cm } center textsf { INPUT VOLTAGE ← ADAPTER } end { minipage }}}}} psline [ linewidth =1pt ] { − > } (2 . 6 , 1 ) ( 3 . 8 , 1 ) rput [ b ] ( 3 . 1 5 , 1 . 1 ) { small $ mathbf { u { 1 } ( t ) }$} % % % % % % % %l%c k %2 % % % % % % % % % % % % % % % % % % % % b o% rput ( 3 . 8 , 1 ) { pspolygon [ linewidth =1pt ] ( 0 , 1 . 5 ) ( 2 , 1 . 5 ) (2 , −1)← (0 , −1) psline [ linewidth =1pt ] ( 0 , 1 ) ( 2 , 1 ) rput [ b ] ( 1 , 1 . 1 5 ) { scriptsiz e textsf { BLOCK 2}} rput ( 1 , 0 ) { psframebox ∗ [ framesep =1pt ] { scriptsiz e { begin { minipage } { 1 . 8 cm } center textsf { DEMODUL . SQUARING ← MULTIPLIER } end { minipage }}}}} psline [ linewidth =1pt ] { − > } (5 . 8 , 1 ) ( 7 , 1 ) rput [ b ] ( 6 . 3 5 , 1 . 1 ) { small $ mathbf { u { 2 } ( t ) }$} % % % % % % % %l%c k %3 % % % % % % % % % % % % % % % % % % % % b o% rput ( 7 , 1 ) { pspolygon [ linewidth =1pt ] ( 0 , 1 . 5 ) ( 6 , 1 . 5 ) (6 , −1) (0 , −1) psline [ linewidth =1pt ] ( 0 , 1 ) ( 6 , 1 ) rput [ b ] ( 3 , 1 . 1 5 ) { scriptsiz e textsf { BLOCK 3}} rput ( 0 . 5 , − 0 . 3 ) { pspolygon ( − 0 . 1 5 , − 0 . 2 5 ) ( − 0 . 1 5 , 1 . 1 ) ( 1 . 4 , 1 . 1 ) ( 1 . 4 , − 0 . 2 5 ) psline [ linewidth =0.5 pt ] ( 0 , 0 ) ( 0 , 1 ) 21
  • 22. 22 CAP´ ´ ITULO 5. EJEMPLOS PRACTICOS psline [ linewidth =0.5 pt ] ( 0 , 0 ) ( 1 . 2 5 , 0 ) pscurve [ linewidth =0.5 pt ] ( 0 , 0 ) ( 0 . 1 , 0 . 7 ) ( 0 . 2 , 0 . 8 ) ( 0 . 6 , 0 . 8 5 ) ( 1 , 0 . 8 ) ← (1.1 ,0.7) (1.2 ,0) psline [ linestyle=dotted , dotsep =0.5 pt , linewidth =0.25 pt ] ( 0 . 1 , 0 ) ← (0.1 ,0.7) psline [ linestyle=dotted , dotsep =0.5 pt , linewidth =0.25 pt ] ( 1 . 1 , 0 ) ← (1.1 ,0.7) rput [ b ] ( 0 . 1 , − 0 . 2 ) { tiny 0 . 0 5 } rput [ b ] ( 1 . 1 , − 0 . 2 ) { tiny 35}} rput ( 2 . 5 , − 0 . 3 ) { pspolygon ( − 0 . 1 5 , − 0 . 2 5 ) ( − 0 . 1 5 , 1 . 1 ) ( 1 . 4 , 1 . 1 ) ( 1 . 4 , − 0 . 2 5 ) psline [ linewidth =0.5 pt ] ( 0 , 0 ) ( 0 , 1 ) psline [ linewidth =0.5 pt ] ( 0 , 0 ) ( 1 . 2 5 , 0 ) pscurve [ linewidth =0.5 pt ] (0 ,0) (0. 05 , 0. 16) (0. 15 , 0. 32) (0. 25 , 0. 48) (0. 325 , 0. 64)← (0.35 ,0.72) (0.44 ,0.8) (0.55 ,0.72) (0.6 ,0.64) (0.725 ,0.48) (0.925 ,0.32) (1.3 ,0.16) psline [ linestyle=dotted , dotsep =0.5 pt , linewidth =0.25 pt← ](0.44 ,0) (0.44 ,0.8) rput [ b ] ( 0 . 4 4 , − 0 . 2 ) { tiny 8 . 8 } } rput ( 5 , 0 ) { psframebox ∗ [ framesep =1pt ] { scriptsiz e { begin { minipage } { 1 . 5 cm } center textsf { RANGE SELECTOR } end {← minipage }}}} rput [ b ] ( 3 , − 0 . 9 ) { scriptsize textsf { DEMODUL . AND WEIGHTING ← FILTERS }}} psline [ linewidth =1pt ]{ − >}(13 ,1) ( 1 4 . 2 , 1 ) rput [ b ] ( 1 3 . 5 5 , 1 . 1 ) { small $ mathbf { u { 3 } ( t ) }$} rput [ b ] ( 1 3 . 5 5 , 0 . 6 ) { small $ mathbf { P { { lin }}}$} % % % % % % % %l%c k %4 % % % % % % % % % % % % % % % % % % % % b o% rput ( 1 4 . 2 , 1 ) { pspolygon [ linewidth =1pt ] ( 0 , 1 . 5 ) ( 2 , 1 . 5 ) (2 , −1)← (0 , −1) psline [ linewidth =1pt ] ( 0 , 1 ) ( 2 , 1 ) rput [ b ] ( 1 , 1 . 1 5 ) { scriptsize textsf { BLOCK 4}} rput ( 1 , 0 ) { psframebox ∗ [ framesep =1pt ] { scriptsiz e { begin { minipage } { 1 . 8 cm } center textsf { SQUARING MULTIPLIE R +← SLIDING MEAN FILTER } end { minipage }}}}} psline [ linewidth =1pt ] { − > } (1 6 . 2 , 1 ) ( 1 7 . 4 , 1 ) rput [ b ] ( 1 6 . 7 5 , 1 . 1 ) { small $ mathbf { u { 4 } ( t ) }$} rput [ b ] ( 1 6 . 7 5 , 0 . 6 ) { small $ mathbf { P { { inst }}}$} % % % % % % % %l%c k %5 % % % % % % % % % % % % % % % % % % % % b o% rput ( 1 7 . 4 , 1 ) { pspolygon [ linewidth =1pt ] ( 0 , 1 . 5 ) ( 2 , 1 . 5 ) (2 , −1)← (0 , −1) psline [ linewidth =1pt ] ( 0 , 1 ) ( 2 , 1 ) rput [ b ] ( 1 , 1 . 1 5 ) { scriptsize textsf { BLOCK 5}} rput ( 1 , 0 ) { psframebox ∗ [ framesep =1pt ] { scriptsiz e { begin { minipage } { 1 . 8 cm } center textsf { STATISTIC A L EVALUATIO N }← end { minipage }}}}} psline [ linewidth =1pt ] { − > } (1 9 . 4 , 1 ) ( 2 0 , 1 ) rput [ b ] ( 2 0 , 1 . 1 ) { small $ mathbf { P { { st }}}$} end { pspicture }
  • 23. 5.1. DIAGRAMA DE BLOQUES 23 BLOCK 1 BLOCK 2 BLOCK 3 BLOCK 4 BLOCK 5 SQUARING ) INPUT u1 (t) DEMODUL. u2 (t) RANGE u3 (t) MULTIPLIER u4 (t) STATISTICAL Pst VOLTAGE SQUARING + SELECTOR Plin Pinst EVALUATION ADAPTER MULTIPLIER SLIDING 0.05 35 8.8 MEAN FILTER DEMODUL. AND WEIGHTING FILTERS