ソースコードの所在: /home/kizu/pgplot/samples/pgex02.f

(このプログラムで描ける絵は、こちら)


      PROGRAM PGEX02
C-----------------------------------------------------------------------
C Repeat the process for another graph. This one is a graph of the
C sinc (sin x over x) function.
C-----------------------------------------------------------------------
      INTEGER I,PGOPEN
      REAL XR(100), YR(100)
c
C Call PGOPEN to initiate PGPLOT and open the output device; PGOPEN
C will prompt the user to supply the device name and type. Always
C check the return code from PGOPEN.
C
      IF (PGOPEN('?') .LE. 0) STOP
C
C Call PGENV to specify the range of the axes and to draw a box, and
C PGLAB to label it. The x-axis runs from -2 to 10, and y from -0.4 to 1.2
C
      CALL PGENV(-2.,10.,-0.4,1.2,0,1)
      CALL PGLAB('(x)', 'sin(x)/x', 
     $             'PGPLOT Example 2:  Sinc Function')
      DO I=1,100
          XR(I) = (I-20)/6.
          YR(I) = 1.0
          IF (XR(I).NE.0.0) YR(I) = SIN(XR(I))/XR(I)
      ENDDO
      CALL PGLINE(100,XR,YR)
C
C Finally, call PGCLOS to terminate things properly.
C
      CALL PGCLOS
C
      END