Hi all, I was wonder why my codes in Matlab aren't compatible with GNURadio ones! After all, I found the fft output in GNURadio is different to Matlab!!
Here is my simple code for fft testing with the real inputs of 0 to 63: #include <iostream> #include <gnuradio/fft/fft.h> using namespace std; using namespace gr; int main() { int fft_size = 64; gr::fft::fft_complex *ifft = new gr::fft::fft_complex (fft_size, true, 1); // making complex data gr_complex in[fft_size]; for (int i=0; i<fft_size; i++) { in[i] = i; } memcpy(ifft->get_inbuf(), in, fft_size); ifft->execute(); cout << "output" << endl; for (int i=0; i<fft_size; i++) { cout << ifft->get_outbuf()[i] << endl; } cout << "THE END!" << endl; return 0; } the output in GNURadio: (28,0) (24.3326,-13.0209) (14.591,-22.0217) (2.07356,-24.4501) (-9.13707,-20.1094) (-15.692,-11.1259) (-16.1531,-1.03318) (-11.3785,6.63407) (-4,9.65685) (2.75122,7.8416) (6.35844,2.87496) (5.93264,-2.55936) (2.38009,-5.98642) (-2.18793,-6.14396) (-5.4952,-3.37881) (-6.11148,0.684235) (-4,4) (-0.398263,5.06997) (2.86434,3.58162) (4.26461,0.45671) (3.27677,-2.67271) (0.553035,-4.28344) (-2.45947,-3.67857) (-4.25578,-1.27436) (-4,1.65685) (-1.899,3.64105) (0.940382,3.727) (3.08336,1.93207) (3.48022,-0.795649) (1.9727,-3.06732) (-0.646391,-3.74757) (-3.04078,-2.51227) (-4,0) (-3.04078,2.51227) (-0.646391,3.74757) (1.9727,3.06732) (3.48022,0.795649) (3.08336,-1.93207) (0.940382,-3.727) (-1.899,-3.64105) (-4,-1.65685) (-4.25578,1.27436) (-2.45947,3.67857) (0.553035,4.28344) (3.27677,2.67271) (4.26461,-0.45671) (2.86434,-3.58162) (-0.398263,-5.06997) (-4,-4) (-6.11148,-0.684235) (-5.4952,3.37881) (-2.18793,6.14396) (2.38009,5.98642) (5.93264,2.55936) (6.35844,-2.87496) (2.75122,-7.8416) (-4,-9.65685) (-11.3785,-6.63407) (-16.1531,1.03318) (-15.692,11.1259) (-9.13707,20.1094) (2.07356,24.4501) (14.591,22.0217) (24.3326,13.0209) the output of the Matlab: 1.0e+03 * 2.0160 -0.0320 + 0.6514i -0.0320 + 0.3249i -0.0320 + 0.2157i -0.0320 + 0.1609i -0.0320 + 0.1278i -0.0320 + 0.1055i -0.0320 + 0.0894i -0.0320 + 0.0773i -0.0320 + 0.0677i -0.0320 + 0.0599i -0.0320 + 0.0534i -0.0320 + 0.0479i -0.0320 + 0.0431i -0.0320 + 0.0390i -0.0320 + 0.0353i -0.0320 + 0.0320i -0.0320 + 0.0290i -0.0320 + 0.0263i -0.0320 + 0.0237i -0.0320 + 0.0214i -0.0320 + 0.0192i -0.0320 + 0.0171i -0.0320 + 0.0151i -0.0320 + 0.0133i -0.0320 + 0.0114i -0.0320 + 0.0097i -0.0320 + 0.0080i -0.0320 + 0.0064i -0.0320 + 0.0047i -0.0320 + 0.0032i -0.0320 + 0.0016i -0.0320 -0.0320 - 0.0016i -0.0320 - 0.0032i -0.0320 - 0.0047i -0.0320 - 0.0064i -0.0320 - 0.0080i -0.0320 - 0.0097i -0.0320 - 0.0114i -0.0320 - 0.0133i -0.0320 - 0.0151i -0.0320 - 0.0171i -0.0320 - 0.0192i -0.0320 - 0.0214i -0.0320 - 0.0237i -0.0320 - 0.0263i -0.0320 - 0.0290i -0.0320 - 0.0320i -0.0320 - 0.0353i -0.0320 - 0.0390i -0.0320 - 0.0431i -0.0320 - 0.0479i -0.0320 - 0.0534i -0.0320 - 0.0599i -0.0320 - 0.0677i -0.0320 - 0.0773i -0.0320 - 0.0894i -0.0320 - 0.1055i -0.0320 - 0.1278i -0.0320 - 0.1609i -0.0320 - 0.2157i -0.0320 - 0.3249i -0.0320 - 0.6514i Please help me!! I'm totally confused. Best
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio