home *** CD-ROM | disk | FTP | other *** search
- INCLUDE 'misciofi.for'
- INCLUDE 'stdhdr.for'
- REAL xdata(0 : maxv), ydata(0: maxv), rr
- REAL tdata(0 : maxv), xcopy(0 : maxv), ycopy(0: maxv)
- INTEGER n, i, wind
- CHARACTER * 80 tempstr
- CHARACTER ch,scancode
- LOGICAL bw
-
- n = 128
- DO i = 0, n - 1
- CALL Random(rr)
- xdata(i) = 6 * COS(pi * i / (19.0+RR))+3.5*
- + COS(pi*i/12.0) + 3.0 * SIN(pi*i/4.0) +
- + 7 * rr * SIN(pi*i/(8.0 + rr))
- ydata(i) = 1.0
- tdata(i) = REAL(i) +1.0
- END DO
- CALL InitSEGraphics(-1, 'c:\for\lib\*.fon')
- CALL BlackAndWhite(bw)
- wind = 1
- DO WHILE (Wind .GE. 0 .AND. wind .LT. 6)
- CALL SetCurrentWindow(10)
- CALL ClearWindow
- CALL BorderCurrentWindow(10)
- CALL LabelGraphWindow(100.0, 900.0,
- + 'FFT Window Options ( 0-5 ): ', 0, 0)
- CALL LabelGraphWindow(100.0, 800.0,
- + '0 - Rectangular ', 0, 0)
- CALL LabelGraphWindow(100.0, 700.0,
- + '1 - Parzen ', 0, 0)
- CALL LabelGraphWindow(100.0, 600.0,
- + '2 - Hanning ', 0, 0)
- CALL LabelGraphWindow(100.0, 500.0,
- + '3 - Welch ', 0, 0)
- CALL LabelGraphWindow(100.0, 400.0,
- + '4 - Hamming ', 0, 0)
- CALL LabelGraphWindow(100.0, 300.0,
- + '5 - Exact Blackman ', 0, 0)
- CALL LabelGraphWindow(100.0, 200.0,
- + '6 - Exit ', 0, 0)
- CALL LabelGraphWindow(100.0, 100.0, 'Enter Selection ? ',0,0)
- CALL ReadKey(ch,scancode)
- WIND = ICHAR(ch)-48
- CALL RealToString(REAL(wind),0,1, tempStr)
- CALL LabelGraphWindow(600.0, 100.0, tempStr, 0, 0)
- CALL CopyVectors(xdata, xcopy, n)
- CALL CopyVectors(ydata, ycopy, n)
- IF (wind .lt. 6) THEN
- CALL SetCurrentWindow(7)
- CALL ClearWindow
- IF( .NOT. BW) CALL SetViewBackground(11)
- CALL SetAxesType(0, 0)
- CALL SelectColor(2)
- CALL AutoAxes(tdata, xcopy, n, 0)
- CALL LinePlotData(tdata, xcopy, n, 1, 0)
- CALL SelectColor(3)
- CALL TitleWindow('Raw Signal Data')
- CALL SetLineStyleXX(1, 1)
- CALL DrawGrid(10)
- CALL SetLineStyleXX(0, 1)
- CALL BorderCurrentWindow(1)
- CALL WindowFFTData(xcopy, ycopy, n, wind)
-
- CALL SetCurrentWindow(8)
- CALL ClearWindow
- IF (.NOT. BW) CALL SetViewBackground(14)
- CALL SetAxesType(0, 0)
- CALL SelectColor(2)
- CALL AutoAxes(tdata, xcopy, n, 0)
- CALL LinePlotData(tdata, xcopy, n, 1, 0)
- CALL SelectColor(3)
- SELECT CASE (wind)
- CASE (0)
- CALL TitleWindow('Signal X Rectangular Window')
- CASE (1)
- CALL TitleWindow('Signal X Parzen Window')
- CASE (2)
- CALL TitleWindow('Signal X Hanning Window')
- CASE (3)
- CALL TitleWindow('Signal X Welch Window')
- CASE (4)
- CALL TitleWindow('Signal X Hamming Window ')
- CASE (5)
- CALL TitleWindow('Signal X Exact Blackman Window')
- END SELECT
- CALL BorderCurrentWindow(wind + 1)
-
- CALL PowerSpectrumCalc(xcopy, ycopy, n, 0.01)
- CALL SetCurrentWindow(9)
- CALL ClearWindow
- IF (.NOT. BW) CALL SetViewBackground(15)
- CALL SelectColor(2)
- CALL SetAxesType(0, 0)
- CALL AutoAxes(ycopy, xcopy, n / 2, 1)
- CALL LinePlotData(ycopy, xcopy, n / 2 - 1, 3, 0)
- CALL TitleWindow('Power Spectrum')
- CALL TitleXAxis('Frequency')
- CALL TitleYAxis('Power')
- CALL BorderCurrentWindow(9)
- END IF
- END DO
- CALL CloseSEGraphics
- END
-
-