cancel
Showing results for 
Search instead for 
Did you mean: 

How to use arm_rfft_q15 properly.

RBen-.1
Associate
  1. I created a 10Hz sine function with phase of pi/4, amplitude of 1000, bias of 2000, a sampling rate of 1kHz, and 2048 samples (20 periods in total) and saved it into q15_t input[2048].
  2. I created a fft stract by arm_rfft_init_q15(&S, 2048, 0, 0)
  3. I entered the input into arm_rfft_q15: arm_rfft_q15(&S, input, output), while output define as q15_t output[4096]

I took the input and output and copied them to Python.

I used fft in Python on the input data.

In addition, I arranged in Python the output of arm_rfft_q15 by calculating the magnitude of the numbers (where each pair of consecutive indexes represents the real and imaginary parts of a number) and then I applied fftshift on the data.

The input, and the fft from python and arm_fft_q15 are attached.

I don't understand why I do not get the same result from python and from arm_fft. Python's result seems logical (one peak at the oscillation frequency) and arm_fft's result are not make sense. Why do I get a lot of peaks and how do I convert the indexes to frequency?

0693W00000HrDsAQAV.png0693W00000HrDs5QAF.png0693W00000HrDrMQAV.png

1 REPLY 1
Rick_Xue
Associate

I am also stock by this problem, if you find answer, please tell me~ thanks~