// FFT_test.c 
// Used to test FFT_func.c
// N-point FFT, where N is defined in FFT_header.h
/*1 */ #include <math.h>
/*2 */ #include <stdio.h>
/*3 */ #include "FFT_header.h"             // defines COMPLEX structure
/*4 */                                     // and FFT order
/*5 */ void FFT_func(COMPLEX *X, COMPLEX *W); // FFT function prototype
/*6 */ 
/*7 */ COMPLEX X[N];                       // Declare input array
/*8 */ COMPLEX W[N2];                      // Used to hold the N/2 twiddle factors
/*9 */ 
/*10*/ int main()
/*11*/ {
/*12*/   short i;                          // loop index
/*13*/ 
/*14*/   // Calculate twiddle factors
/*15*/   for(i=0; i<N2; i++) 
/*16*/   {
/*17*/     W[i].real = cos(2.0*PI*i/N);
/*18*/     W[i].imag = sin(2.0*PI*i/N);
/*19*/   }
/*20*/ 
/*21*/   // Initialize input array
/*22*/   for(i=0; i<N; i++) 
/*23*/   {
/*24*/     X[i].real = cos((float) 2.0*PI*3*i/N);
/*25*/     X[i].imag = 0.0;
/*26*/   }
/*27*/   
/*28*/   FFT_func(X,W);                    // perform in-place FFT
/*29*/ 
/*30*/   // Display results on screen
/*31*/   for(i=0; i<N; i++)
/*32*/   	printf("X[%d] = \t%10.5f + j %3.5f\n",i,(X[i]).real, (X[i]).imag);
/*33*/	 return 0;
/*34*/ }
