Application example of FftReal class. FftReal クラスの使用例.

Dependencies:   Array_Matrix mbed UIT_FFT_Real

Revision:
1:f070e455cea0
Parent:
0:5bed9d6dc43b
Child:
2:03e1399ed9eb
--- a/main.cpp	Fri Dec 19 12:12:12 2014 +0000
+++ b/main.cpp	Fri Dec 19 12:34:56 2014 +0000
@@ -1,5 +1,5 @@
 //--------------------------------------------------------------
-// Test of FftReal class
+// Demo program of FftReal class
 // Copyright (c) 2014 MIKAMI, Naoki,  2014/12/19
 //--------------------------------------------------------------
 
@@ -17,6 +17,7 @@
     float x1[N], x2[N];
     Complex y1[N], y2[N/2+1];
 
+    // Generate random data
     srand(1234);
     for (int n=0; n<N; n++)
         x1[n] = 2.0f*rand()/(float)RAND_MAX - 1.0f;
@@ -24,14 +25,16 @@
     for (int n=0; n<N; n++)
         printf("f[%2d]: %8.4f\r\n", n, x1[n]);
 
+    // DFT, for comarison
     DftComplex(x1, y1, N);
     printf("\r\n#### Result of direct DFT ####\r\n");
     printf("          real    imaginary\r\n");
     for (int n=0; n<N; n++)
         printf("F[%2d]: %8.4f, %8.4f\r\n", n, y1[n].real(), y1[n].imag());
 
-    Timer tm;
+    Timer tm;   // for measurement of execution time
 
+    // FFT
     FftReal fft(N);
     tm.reset();
     tm.start();
@@ -42,6 +45,7 @@
     for (int n=0; n<=N/2; n++)
         printf("F[%2d]: %8.4f, %8.4f\r\n", n, y2[n].real(), y2[n].imag());
     
+    // IFFT
     tm.reset();
     tm.start();
     fft.ExecuteIfft(y2, x2);