单片机/MCU论坛
直播中

刘刚

7年用户 1024经验值
私信 关注
[问答]

为什么fft函数在bf592中运行out_ifft数据和in数据有区别?

/* Compute  IFFT( CFFT( X ) ) = X */
#include
   
#define N_FFT  64
complex_fract16   in[N_FFT];
complex_fract16   out_cfft[N_FFT];
complex_fract16   out_ifft[N_FFT];
complex_fract16   twiddle[N_FFT/2];
int               blk_exp;
   
void ifft_fr16_example(void)
{
    int i;
    /* Generate DC signal */
    for( i = 0; i < N_FFT; i++ )
    {
       in[i].re = 0x100;
       in[i].im = 0x0;
    }
   
    /* Populate twiddle table */
    twidfftrad2_fr16(twiddle, N_FFT);
     
    /* Compute Fast Fourier Transform */
    cfft_fr16(in, out_cfft, twiddle, 1, N_FFT,  blk_exp, 0);
   
    /* Reverse static scaling applied by cfft_fr16() function
       Apply the shift operation before the call to the
       ifft_fr16() function only if all the values in out_cfft
       = 0x100. Otherwise, perform the shift operation after the
       ifft_fr16() function has been computed.
    */
    for( i = 0; i < N_FFT; i++ )
    {
       out_cfft[i].re = out_cfft[i].re << 6; /* log2(N_FFT) = 6 */
       out_cfft[i].im = out_cfft[i].im << 6;
    }
   
    /* Compute Inverse Fast Fourier Transform
       The output signal from the ifft function will be the same
       as the DC signal of magnitude 0x100 which was passed into
       the cfft function.
    */
    ifft_fr16(out_cfft, out_ifft, twiddle, 1, N_FFT,  blk_exp, 0);
}
  
为什么fft函数在 bf592中运行 out_ifft 数据和in数据有区别??? 傅里叶变换和逆变换的 结果有差距呢

回帖(1)

洪茗苞

2024-1-12 10:59:25
It is difficult to determine the exact reason why there might be a difference between the input and output data when using the FFT function in the BF592 processor without further information or code details. However, here are a few possible reasons:

1. Input Data Scaling: Depending on the implementation and configuration of the FFT function, there might be a scaling factor applied to the input data. This scaling could result in a difference between the input and output data.

2. Precision Differences: The FFT function might use a different precision or rounding technique compared to the IFFT function, leading to small differences in the output data.

3. Twiddle Factors: The twiddle factors used in the FFT and IFFT calculations might differ slightly, resulting in a discrepancy between the input and output data.

To accurately determine the cause of the difference, it is necessary to analyze the code or provide more details about the specific implementation and parameters used.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分