#include <stdio.h> #include <math.h> #include <numeric.h> #define N1 4 #define N2 3 #define M 3 int main() { int i,j,k,retval; array double complex x1[N1][N2],y1[N1][N2],x3[N1][N2]; array double complex y[M][M],x2[M][M]; int dim[2]; urand(x1); dim[0]=M;dim[1]=M; fft(y,x1,dim); dim[0]=M;dim[1]=M; ifft(x2,y,dim); printf("Input data =\n"); printf("%5.3f",x1); printf("\nFFT result data =\n"); printf("%5.3f",y); printf("\nFFT + iFFT result data =\n"); printf("%5.3f",x2); fft(y1,x1); ifft(x3,y1); printf("\n\nInput data =\n"); printf("%5.3f",x1); printf("\nFFT result data =\n"); printf("%5.3f",y1); printf("\nFFT + iFFT result data =\n"); printf("%5.3f",x3); }
Input data = complex(0.514,0.000) complex(0.176,0.000) complex(0.309,0.000) complex(0.535,0.000) complex(0.948,0.000) complex(0.172,0.000) complex(0.702,0.000) complex(0.226,0.000) complex(0.495,0.000) complex(0.125,0.000) complex(0.084,0.000) complex(0.390,0.000) FFT result data = complex(0.514,0.000) complex(0.176,0.000) complex(0.309,0.000) complex(0.535,0.000) complex(0.948,0.000) complex(0.172,0.000) complex(0.702,0.000) complex(0.226,0.000) complex(0.495,0.000) FFT + iFFT result data = complex(0.514,0.000) complex(0.176,0.000) complex(0.309,0.000) complex(0.535,0.000) complex(0.948,0.000) complex(0.172,0.000) complex(0.702,0.000) complex(0.226,0.000) complex(0.495,0.000) Input data = complex(0.514,0.000) complex(0.176,0.000) complex(0.309,0.000) complex(0.535,0.000) complex(0.948,0.000) complex(0.172,0.000) complex(0.702,0.000) complex(0.226,0.000) complex(0.495,0.000) complex(0.125,0.000) complex(0.084,0.000) complex(0.390,0.000) FFT result data = complex(0.514,0.000) complex(0.176,0.000) complex(0.309,0.000) complex(0.535,0.000) complex(0.948,0.000) complex(0.172,0.000) complex(0.702,0.000) complex(0.226,0.000) complex(0.495,0.000) complex(0.125,0.000) complex(0.084,0.000) complex(0.390,0.000) FFT + iFFT result data = complex(0.514,0.000) complex(0.176,0.000) complex(0.309,0.000) complex(0.535,0.000) complex(0.948,0.000) complex(0.172,0.000) complex(0.702,0.000) complex(0.226,0.000) complex(0.495,0.000) complex(0.125,0.000) complex(0.084,0.000) complex(0.390,0.000)