/* FFT_TEST.C R.Tervo 16 FEB 97 */ /* ------------------------------------------------------------- */ /* Test the FFT routine, written using Microsoft C Version 5.1 */ /* Copyright (c) 1997 SCCON Scientific Research Inc. */ /* For information, contact < tervo@sccon.ca > */ /* ------------------------------------------------------------- */ /* 1. Assemble the FFT routine to create fft5.OBJ, using: */ /* C> masm fft5.asm; */ /* 2. Compile the test program to create FFT_TEST.EXE, using: */ /* C> cl fft_test.c fft5.obj */ /* 3. Run the test program */ /* C> fft_text.exe */ /* ------------------------------------------------------------- */ /* This test program computes the discrete Fourier transform of */ /* an 8-element vector consisting of an impulse at the origin. */ /* The complex result should be eight real values, all 0.125 */ /* ------------------------------------------------------------- */ #include struct complex { double r; /* real part */ double i; /* imag part */ } vec[8]; /* prototype definition */ extern void FFT5( struct complex *vector, int N, int direction ); main() { int x; for(x=0;x<8;x++) /* Create input vector */ { vec[x].r = 0.000; /* set real components zero */ vec[x].i = 0.000; /* set imag components zero */ } vec[0].r = 1.000; /* impulse at the origin */ FFT5( vec, 3, 0 ); /* compute FFT for 8 points */ for(x=0;x<8;x++) /* Display output vector */ printf("REAL[%i]= %2.3f,IMAG[%i]= %2.3f\n",x,vec[x].r,x,vec[x].i); return 0; }