We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I have a code that computes FFT using fftpack functions npy_rffti and npy_rfftf . I want to replace them using arm library functions. I have a real signal. I wrote the below code.
arm_rfft_fast_instance_f32 rfft_instance; arm_rfft_fast_init_f32(&rfft_instance, 1024); static float32_t *rfft_result; rfft_result = malloc(n * sizeof(float32_t)); arm_rfft_fast_f32(&rfft_instance, accel_copy, rfft_result, 0);
Below is my existing code with fftpack functions:
int len_rffti = 2*n + 15; /* 15 extra 32-bit ints used as storage in fftpack's state */ Treal* rffti = malloc(len_rffti * sizeof(Treal)); npy_rffti(n, rffti); /* calculates rffti */ int len_buf = (n/2 + 1) * 2; /* n+1 if n is odd. otherwise n+2. buf[0] is DC component and is ignored */ Treal* buf = malloc(len_buf * sizeof(Treal)); /* fill raw accel signal into buffer */ buf[0] = 0.0f; for (i = 0; i < n; i++) { buf[i+1] = (Treal) accel[i]; } /* calculate FFT. puts FFT into buffer */ npy_rfftf(n, buf+1, rffti);
Both produce very different values of FFT. What am i doing wrong? Any help is appreciated. Thanks
How, exactly, are they "different" ?
What debugging / testing / investigation have you done to find the problem(s) ?