This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem with arm_rfft_fast_f32

Hi I tested  arm_rfft_fast_f32 function from CMSIS-DSP 1.4.4 with generated 50hz sine wave at 1000Hz sample rate using 1024 samples, but i get peek value at 102, not 51 which i should get 1000/1024 ~0,97 * 51 = 50Hz:

uint16_t i;

     float32_t khz10[1024];

     float32_t maxvalue;

     uint32_t maxindex;

     //float32_t output2[1024];

     arm_rfft_fast_instance_f32 S;

     arm_rfft_fast_init_f32(&S, 1024);

     printf("Input=[");

     for(i=0; i<1024; i++){

         khz10[i] = 1.2f*arm_sin_f32(2*3.1415926f*50*i/1000)+1;

         printf("%f,",khz10[i]);

     }

     printf("]\r\n");

     arm_rfft_fast_f32(&S, khz10,khz10,0);

     arm_abs_f32(khz10, khz10, 1024);

     arm_max_f32(khz10+1, 1023, &maxvalue, &maxindex);

     printf("Max:[%ld]:%f Output=[",maxindex,maxvalue);

     for(i=0; i<1024; i++){

         printf("%f,",khz10[i]);

     }

     printf("]\r\n");

I later tested this function  with real data from adc and I can only get 1/4 of frequency spectrum

not about 1/2 as I expected. Can anyone could me explain this ?

Parents Reply Children
No data