!!      PROGRAM Smoothwe

      INCLUDE 'STDHDR.FOR'
      REAL xdata(0:maxv), ydata(0:maxv)
      REAL smoothdata(0:maxv), weights(0:maxc)
      INTEGER smoothnum,n,i
      REAL wdivisor, rr
      CHARACTER * 80 pathname

      PRINT 10, 'Smoothnum =   '
      READ *, smoothnum

      DO i = 1, smoothnum
        PRINT 20, 'Weight',i,':'
        READ *, weights(i)
      END DO

      N = 100

      PRINT 10, 'Weight divisor   '
      READ *, wdivisor
10    FORMAT (1X, A15 \)
20    FORMAT (1X, A7, I3, A2\)

      DO i = 0,  n
        CALL Random(rr)
        xdata(i) = i
        ydata(i) = COS(i/10.0) + rr
      end do

      pathname = 'c:\for\lib\*.fon'
      CALL InitSEGraphics(-1,pathname)
      CALL SetCurrentWindow(3)
      CALL ClearWindow
      CALL SetAxesType(0, 0)
      CALL SelectColor(2)
      CALL AutoAxes(xdata, ydata, n, 0)
      CALL LinePlotData(xdata, ydata, n, 1, 0)
      CALL TitleWindow('original data')

      CALL SetCurrentWindow(4)
      CALL SelectColor(2)
      CALL SetAxesType(0, 0)
      CALL DataSmoothWeights(ydata, n, smoothnum, weights,
     +   wdivisor, smoothdata)
      CALL AutoAxes(xdata, smoothdata, n, 0)
      CALL LinePlotData(xdata, smoothdata, n, 15, 0)
      CALL TitleWindow('Smoothed Data')
      READ (*,*)
      CALL CloseSEGraphics
      END



