/* From: "COMPUTATIONAL PHYSICS, 2nd Ed" by RH Landau, MJ Paez, and CC Bordeianu Copyright Wiley-VCH, 2007. Electronic Materials copyright: R Landau, Oregon State Univ, 2007; MJ Paez, Univ Antioquia, 2007; & CC Bordeianu, Univ Bucharest, 2007 Support by National Science Foundation */ // invfour.c: Inverse Discrete Fourier Transformation /* comment: The program reads its input data from a file in the * same directory fourier.dat which must have the same format * frequency index real part imaginary part * as created with the program fourier.c * The output has the same format. * related programs: fourier.c */ #include #include #define max 10000 #define PI 3.1415926535897932385E0 main() { double imag, real, input [2][max]; int i = 0, j, k; FILE *data; FILE *output; data = fopen("fourier.dat", "r"); // read data from output = fopen("invers.dat", "w"); // save data in while (fscanf(data, "%d %lf %lf", &j, &input[0][i], &input[1][i]) != EOF) { i++; } // input[0][x]:real, input[1][x]:imaginary for (j = 0; j