home *** CD-ROM | disk | FTP | other *** search
- MODULE FFTTest;
- (* (C) M. Kowalik & PASCAL INTERNATIONAL *)
- (* Aladin ETH Modula-2 *)
-
- FROM SYSTEM IMPORT PROCESS;
- FROM OutTerminal IMPORT WriteC;
- FROM Terminal IMPORT Write, WriteString,
- WriteLn, ClearTerminal;
- FROM RealTerminal IMPORT WriteR, RFixed;
- FROM Fourier IMPORT Interpolation, RungeFaltung, DFT, FFT;
-
- CONST N = 512; (* max number of points *)
- NN = N - 1;
- p = N DIV 2;
- L = 4;
- tim=16cH; (* 60 tics per second timer addres *)
- (* for Aladin {Mac as well} *)
-
- TYPE Field = ARRAY [0..NN] OF REAL;
-
- VAR
- i : CARDINAL;
- t : REAL;
- x, y, A, B : Field;
- a : ARRAY [0..p] OF REAL;
- b : ARRAY [1..p] OF REAL;
- Start, Stop, s[tim], z[tim] : CARDINAL;
-
- BEGIN
- FOR i := 1 TO N - 1 DO
- y[i] := -1.0 + (FLOAT(i) - 1.0)/FLOAT(N - 2)
- END;
-
- ClearTerminal;
- WriteString(' Fourier interpolation...'); WriteLn;
- Start := s;
- Interpolation(x, y, a, b);
- Stop := z;
- WriteString('Elapsed time in tics (1/60 s) =');
- WriteC(Stop-Start,8);
- WriteLn;
-
- WriteString(' Runge Faltung...'); WriteLn;
- Start := s;
- RungeFaltung(x, y, a, b);
- Stop := z;
- WriteString('Elapsed time in tics (1/60 s) =');
- WriteC(Stop-Start,8);
- WriteLn;
-
- WriteString(' Discrete Fourier Transformation...'); WriteLn;
- Start := s;
- DFT(x, y, a, b);
- Stop := z;
- WriteString('Elapsed time in tics (1/60 s) =');
- WriteC(Stop-Start,8);
- WriteLn;
- WriteString(' Fast Fourier Transformation...'); WriteLn;
- Start := s;
- FFT(x, y, a, b);
- Stop := z;
- WriteString('Elapsed time in tics (1/60 s) =');
- WriteC(Stop-Start,8);
- WriteLn
- END FFTTest.