This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
We are using the Hercules DSPLIB v1.0.0 to perform some signal processing in our application. To simply touch base with the Library we simply tried to perform an 128-point FFT of a DC signal to expect an impulse response.
Code excerpt below:
float32_t test[128] = {1.0};
arm_rfft_instance_f32 rfft_instance;
arm_rfft_instance_f32* rfft_instance_ptr = (arm_rfft_instance_f32*) &rfft_instance;
arm_cfft_radix4_instance_f32 cfft_instance;
arm_cfft_radix4_instance_f32* cfft_instance_ptr = (arm_cfft_radix4_instance_f32*) &cfft_instance;
arm_rfft_init_f32(rfft_instance_ptr,cfft_instance_ptr,128,0,1);
float32_t out[256] = { 0.0 };
arm_rfft_f32(rfft_instance_ptr,test,out);
However, when I printed the result of "out" I got a stream of 1, 0, 1, 0 .... instead of an impulse of magnitude of 128.
real[0]=1, real[1]=1, real[2]=1 ....
complex[0]=0,complex[1]=0,complex[2]=0 ...
Am I using this function incorrectly ?
Hello Dhruva,
BTW, which device are you using?
The format of the output of arm_rfft_f32(...) is: { real[0], imag[0], real[1], imag[1], real[2], imag[2] ... real[(N/2)-1], imag[(N/2)-1 }
N/2 are the real parts and N/2 are imaginary parts interleaved, in total N/2 complex pairs.
Hi Wang,
Yes. It's just that I got a stream of alternate 1s and 0s as output. The FFT of a DC signal should have given me a purely-real impulse response.
I was expecting only real[0], to have a value and everything else to be zero.
Expected output was [128,0,0,0,0,.....]
but what I got was [1,0,1,0,1,0..........]
I am using it on an AM6546. We compiled the HerculesLIB for the R5F and got things going.
Dhruva Krishnadas said:float32_t test[128] = {1.0};
I believe this only initializes the first element to 1.0. All others will be 0.0. Have you double checked in the debugger?