Area between two curves example

The script below, `fill.pcm`, will fill the area between two curves with a solid color. It expects five parameters which are the four vectors containing the two sets of data. The fifth parameter the script expects is the name of the fixed color to use for filling.

      ! fill.pcm
      !
      X0 = ?1
      Y0 = ?2
      X02 = ?3
      Y02 = ?4
      L = LEN(X0)
      L1 = LEN(X02)
      X0[L+1:L+L1] = X02[L1:1:-1]
      Y0[L+1:L+L1] = Y02[L1:1:-1]
      SET AREAFILLCOLOR STRING(?5)
      GRAPH X0 Y0
      DEFAULTS

The following commands generate some data and call `fill.pcm`, producing the figure below.

     GENERATE X 0,,180 100
     Y=SIND(X)
     GENERATE X1 0,,180 50
     Y1=EXP(-X1/90)*SIND(X1)
     @FILL X Y X1 Y1 RED

Histogram example