Frequency Bin Example
- group Frequency Bin Example
Refer riscv_fft_bin_example_f32.c
- Description
Demonstrates the calculation of the maximum energy bin in the frequency domain of the input signal with the use of Complex FFT, Complex Magnitude, and Maximum functions.
- Algorithm:
The input test signal contains a 10 kHz signal with uniformly distributed white noise. Calculating the FFT of the input signal will give us the maximum energy of the bin corresponding to the input frequency of 10 kHz.
- Block Diagram:

The figure below shows the time domain signal of 10 kHz signal with uniformly distributed white noise, and the next figure shows the input in the frequency domain. The bin with maximum energy corresponds to 10 kHz signal.


- Variables Description:
testInput_f32_10khzpoints to the input datatestOutputpoints to the output datafftSizelength of FFTifftFlagflag for the selection of CFFT/CIFFTdoBitReverseFlag for selection of normal order or bit reversed orderrefIndexreference index value at which maximum energy of bin ocuurstestIndexcalculated index value at which maximum energy of bin ocuurs
- NMSIS DSP Software Library Functions Used:
riscv_cfft_f32()
riscv_cmplx_mag_f32()
riscv_max_f32()