Hi,

I am using rfft_fr16 to generate the fft of any signal. As a prelimnary test I tried to generate the fft of a simple sine wave and plotted it. The problem is that when I run the same code with different input sine frequencies the ouput peak has different amplitudes. As far as I understand the amplitude should not depend on the sine frequency as long as we don't start playing with the sine wave. Can someone point out why this is happening.

regards,

Shekhar.

PS: I am using scaling factor "1". and trying it for a 512 point fft.

Hi Shekhar,

Please find attached an example to achieve what you are after.

A few points to note:

To perform the comparison, one should look at the magnitude (combining the real and imaginary amplitudes) rather than the raw output from the Fourier transform.

Noise, such as rounding errors, can have a significant impact on the comparison. To minimize such errors, the input signal was computed using values that could be accurately represented as floating point values (powers of 2 are best). It is also important to avoid floating point values that would saturate when being converted to fixed point, hence the scaling of the sine function by 0.75.

You will find that applying a window before computing the fft helps in getting more accurate results.

The program should be run on hardware or the compiled simulator.

Hope this helps.

AndreasL