简体   繁体   English

通过对FFT结果进行共轭来使用FFT进行IFFT

[英]IFFT using FFT by taking conjugate of the FFT result

I am doing fixed point FFT on 8bit pic microcontrller using C language, i am able to get the FFT result from the sample i have taken but i am getting wrong output when i do the IFFT for the FFT result. 我正在使用C语言在8位pic微控制器上进行定点FFT,我能够从所采集的样本中获得FFT结果,但是当我对FFT结果执行IFFT时,输出错误。

The flow of program i am doing is as follows 我正在执行的程序流程如下

  1. Doing FFT for 8 samples say example: Real value are (1,0,0,0,0,0,0,0) and Imaginary values are (0,0,0,0,0,0,0,0) 对8个样本执行FFT例如:实际值是(1,0,0,0,0,0,0,0)和虚数是(0,0,0,0,0,0,0,0)
  2. The output of the FFT is (1,1,1,1,1,1,1,1) and imaginary values are (0,0,0,0,0,0,0,0) FFT的输出为(1,1,1,1,1,1,1,1,1),虚数值为(0,0,0,0,0,0,0,0,0)
  3. Then taking the conjugate of FFT output 然后取FFT输出的共轭
  4. Doing FFT for the conjugated result 对共轭结果进行FFT
  5. Again taking the conjugate of the second time FFT result 再次取第二次FFT结果的共轭
  6. Finally dividing by 8 to get the original samples in time domain The output is Real value are (1,0,0,0,0,0,0,0) and Imaginary values are (0,-0,-0,-0,-0,-0,-0,-0); 最后除以8得到时域中的原始样本输出为实数值为(1,0,0,0,0,0,0,0)和虚数值为(0,-0,-0,-0 ,-O - , - O - , - O - , - O);

But if i apply the same for Real values (1,2,3,4,5,6,7,8) and imaginary values (0,0,0,0,0,0,0,0) i am getting wrong result such as real value after IFFT are (1,2,4,7,4,5,4,5) and Imaginary values are(-0,-3,-1,-0,1,0,0,2) 但是,如果我对实数值(1,2,3,4,5,6,7,8)和虚数值(0,0,0,0,0,0,0,0)应用相同的值,那我就错了IFFT之后的实际值之类的结果是(1,2,4,7,4,5,4,5)和虚数是(-0,-3,-1,-0,1,0,0,2)

please help me what i am doing wrong... 请帮我我在做什么错...

The FFT solves an interpolation problem, the IFFT the corresponding multi-point evaluation problem FFT解决了插值问题,IFFT解决了相应的多点评估问题

The result of the FFT are coefficients of a polynomial p(z) where p(w k )=x k , w is the unit root associated with the dimension D of the FFT. FFT的结果是多项式p(z)的系数,其中p(w k )= x k ,w是与FFT的维数D相关的单位根。

Denote with p s,k (z) the polynomial formed from the subsequence of coefficients of p(z) starting in k and spaced with index distance s. 用p s,k (z)表示多项式,该多项式由p(z)的系数的子序列组成,这些子序列从k开始并与索引距离s间隔开。

If D=2N is even, the general idea to get from the values to the coefficients is to use w N =-1 and the decomposition 如果D = 2N是偶数,则从值到系数的一般想法是使用w N = -1并进行分解

p(z) = p 2,0 (z²) + z * p 2,1 (z²) p(z)= p 2,0 (z²)+ z * p 2,1 (z²)

in the relations 在关系中

x k = p(w k )=p 2,0 (w 2k ) + w k * p 2,1 (w k ) x k = p(w k )= p 2,0 (w 2k )+ w k * p 2,1 (w k

x N+k = p(w N+k ) = p(-w k ) x N + k = p(w N + k )= p(-w k

= p 2,0 (w 2k ) - w k * p 2,1 (w 2k ) = p 2,0 (w 2k )-w k * p 2,1 (w 2k

to reduce the big interpolation problem into two subproblems of half the size, 将大插值问题简化为两个大小只有一半的子问题,

2*p 2,0 (w 2k ) = x k + x N+k 2 * p 2,0 (w 2k )= x k + x N + k

2*p 2,1 (w 2k ) = w -k * (x k - x N+k ) 2 * p 2,1 (w 2k )= w -k *(x k -x N + k

In the next step, 在下一步中

  • p 2,0 is reduced to p 4,0 and p 4,2 , and p 2,0减小为p 4,0和p 4,2 ,并且
  • p 2,1 is reduced to p 4,1 and p 4,3 p 2,1减少到p 4,1和p 4,3

etc. 等等


For the sequence of 8 inputs, one gets in the first step w=(1+i)/sqrt(2) and w 2 =i 对于8个输入的序列,第一步进入w =(1 + i)/ sqrt(2),而w 2 = i

  • x 1,0 = 2*p 2,0 ( 1) = x 0 + x 4 x 1,0 = 2 * p 2,0 (1)= x 0 + x 4
  • x 1,2 = 2*p 2,0 ( i) = x 1 + x 5 x 1,2 = 2 * p 2,0 (i)= x 1 + x 5
  • x 1,4 = 2*p 2,0 (-1) = x 2 + x 6 x 1,4 = 2 * p 2,0 (-1)= x 2 + x 6
  • x 1,6 = 2*p 2,0 (-i) = x 3 + x 7 x 1,6 = 2 * p 2,0 (-i)= x 3 + x 7

.. ..

  • x 1,1 = 2*p 2,1 ( 1) = (x 0 - x 4 )*1 x 1,1 = 2 * p 2,1 (1)=(x 0 -x 4 )* 1
  • x 1,3 = 2*p 2,1 ( i) = (x 1 - x 5 )*(1-i)/sqrt(2) x 1,3 = 2 * p 2,1 (i)=(x 1 -x 5 )*(1-i)/ sqrt(2)
  • x 1,5 = 2*p 2,1 (-1) = (x 2 - x 6 )*(-i) x 1,5 = 2 * p 2,1 (-1)=(x 2 -x 6 )*(-i)
  • x 1,7 = 2*p 2,1 (-i) = (x 3 - x 7 )*(-1-i)/sqrt(2) x 1,7 = 2 * p 2,1 (-i)=(x 3 -x 7 )*(-1-i)/ sqrt(2)

In the next step, one gets w=i and w 2 =-1 在下一步中,将得到w = i和w 2 = -1

  • x 2,0 = 4*p 4,0 ( 1) = x 1,0 + x 1,4 x 2,0 = 4 * p 4,0 (1)= x 1,0 + x 1,4
  • x 2,4 = 4*p 4,0 (-1) = x 1,2 + x 1,6 x 2,4 = 4 * p 4,0 (-1)= x 1,2 + x 1,6

.. ..

  • x 2,2 = 4*p 4,2 ( 1)= (x 1,0 - x 1,4 )*1 x 2,2 = 4 * p 4,2 (1)=(x 1,0 -x 1,4 )* 1
  • x 2,6 = 4*p 4,2 (-1)= (x 1,2 - x 1,6 ) * (-i) x 2,6 = 4 * p 4,2 (-1)=(x 1,2 -x 1,6 )*(-i)

-- -

  • x 2,1 = 4*p 4,1 ( 1) = x 1,1 + x 1,5 x 2,1 = 4 * p 4,1 (1)= x 1,1 + x 1,5
  • x 2,5 = 4*p 4,1 (-1) = x 1,3 + x 1,7 x 2,5 = 4 * p 4,1 (-1)= x 1,3 + x 1,7

.. ..

  • x 2,3 = 4*p 4,3 ( 1)= (x 1,1 - x 1,5 )*1 x 2,3 = 4 * p 4,3 (1)=(x 1,1 -x 1,5 )* 1
  • x 2,7 = 4*p 4,3 (-1)= (x 1,3 - x 1,7 ) * (-i) x 2,7 = 4 * p 4,3 (-1)=(x 1,3 -x 1,7 )*(-i)

and finally the FFT coefficients X k =x 3,k using w=-1 and w²=1 最后使用w = -1和w²= 1的FFT系数X k = x 3,k

  • X 0 = 8*p 8,0 ( 1) = x 2,0 + x 2,4 X 0 = 8 * p 8,0 (1)= x 2,0 + x 2,4
  • X 4 = 8*p 8,4 ( 1) = (x 2,0 - x 2,4 )*(-1) X 4 = 8 * p 8,4 (1)=(x 2,0 -x 2,4 )*(-1)

-- -

  • X 2 = 8*p 8,2 ( 1) = x 2,2 + x 2,6 X 2 = 8 * p 8,2 (1)= x 2,2 + x 2,6
  • X 6 = 8*p 8,6 ( 1) = (x 2,2 - x 2,6 )*(-1) X 6 = 8 * p 8,6 (1)=(x 2,2 -x 2,6 )*(-1)

-- -

  • X 1 = 8*p 8,1 ( 1) = x 2,1 + x 2,5 X 1 = 8 * p 8,1 (1)= x 2,1 + x 2,5
  • X 5 = 8*p 8,5 ( 1) = (x 2,1 - x 2,5 )*(-1) X 5 = 8 * p 8,5 (1)=(x 2,1 -x 2,5 )*(-1)

-- -

  • X 3 = 8*p 8,3 ( 1) = x 2,3 + x 2,7 X 3 = 8 * p 8,3 (1)= x 2,3 + x 2,7
  • X 7 = 8*p 8,7 ( 1) = (x 2,3 - x 2,7 )*(-1) X 7 = 8 * p 8,7 (1)=(x 2,3 -x 2,7 )*(-1)

Please check that these steps are reflected in your code, especially, that the square root of 2 occurs at the necessary places. 请检查这些步骤是否在您的代码中得到反映,尤其是2的平方根是否出现在必要的位置。 It is highly unlikely that the output of random integer inputs is again strictly integer. 随机整数输入的输出极不可能再次严格地是整数。

In your description there, at no point do you take an inverse DFT. 在您的描述中,您绝不会进行逆DFT。

Think about what is going on, lets say you have the the DFT result as X, taking X*X is going to give you the power spectrum, not an inverse DFT. 想想发生了什么,假设您得到的DFT结果为X,取X * X将为您提供功率谱,而不是反向DFT。 Then preforming an DFT on this will not give you a time domain, it will give you nonsense. 然后为此执行DFT不会给您时域,这会给您带来胡扯。

you need to find the inverse DFT function in the library you are using. 您需要在使用的库中找到DFT逆函数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM