discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with OOT C++ fft


From: George Edwards
Subject: Re: Problems with OOT C++ fft
Date: Wed, 20 Apr 2022 09:42:29 -0500

Hello GNURadio Community, 

Please ignore the above problem, I figured it out.

George

On Sun, Apr 17, 2022 at 5:16 PM George Edwards <gedwards.eng@gmail.com> wrote:
Dear Gnuradio Community,

I am writing an OOT signal processing algorithm in C++ that requires both fft and ifft. I use the Gnuradio C++ library to get the fft and ifft functions. To confirm understanding of setting up these functions, I wrote C++ OOT blocks for both fft and ifft blocks. I ran a complex sinusoid into the fft block and fed its output to the ifft block to reverse the process. In the GRC flowgraph, the time and frequency plots seem correct (the output of the ifft shows the sinusoidal frequency it recovers is right on mark). 

For further validation, I decided to compare Gnuradio C++ fft computation to that of Matlab. I created a Python QA file to Debug the fft block and examine the fft  computation. For the experiment, I fed 8 complex data samples into the fft block to see how its fft computation compares to that of Matlab. The OOT fft computation was not correct! Here is a snippet of my C++ OOT code written to test the fft computation (below "in and out" points to the addresses of Gnuradio input/out data variables).

memcpy(d_fft.get_inputbuf(), in, sizerof(gr_complex)*d_fft_size);
d_fft.execute();
memcpy(out, d_fft.get_output(), sizerof(gr_complex)*d_fft_size);
gr_complex c_data[8];
for(int i = 0; i < 8; i++) {
      c_data[i] = out[i];
}
As can be seen in my code, I wrote the fft output into the array variable c_data. c_data has 1+1j in c_data[0] and all the other elements of the array have values 0+0j. The values are all wrong (not the same as Matlab). So I am at a loss!

I appreciate any suggestions?

Thank you!
George

reply via email to

[Prev in Thread] Current Thread [Next in Thread]