
      PROGRAM FFTPOWER
      INCLUDE 'stdhdr.for'

      REAL xdata(0: maxv), ydata(0: maxv)
      REAL tdata(0: maxv)
      INTEGER  n, i
      LOGICAL BW

       n = 2048
       DO i = 0, n - 1
         xdata(i) = 6 * COS(pi * i / (19.0)) + 3.5 *
     +      COS(pi * i / 32.0) + 3.0 * SIN(pi * i / 4.0)
         ydata(i) = 0.01
         tdata(i) = REAL(i) + 1.0
       END DO
       CALL InitSEGraphics(-1, 'C:\FOR\LIB\*.FON')
       CALL BlackAndWhite(BW)
       CALL SetCurrentWindow(3)
       CALL ClearWindow
       IF (.NOT. BW)  CALL SetViewBackground (15)
       CALL SetAxesType(0, 0)
       CALL SelectColor(1)
       CALL AutoAxes(tdata, xdata, n, 0)
       CALL LinePlotData(tdata, xdata, n, 2, 0)
       CALL TitleWindow('Original data')

       CALL PowerSpectrumCalc(xdata, ydata, n, .01)
       ydata(0) = 0.01
       CALL SetCurrentWindow(4)
       IF (.NOT. BW)  CALL SetViewBackground (15)
       CALL SelectColor(1)
       CALL SetAxesType(0, 0)
       CALL AutoAxes(ydata, xdata, n / 2, 0)
       CALL LinePlotData(ydata, xdata, n / 2, 2, 1)
       CALL TitleWindow('Power Spectrum')
       CALL TitleXAxis('Frequency')
       CALL TitleYAxis('Power')
       READ (*,*)
      CALL CloseSEGraphics
      END




