Based on the steps and features of the DIT and DIF analyzed in the textbook, two basic 2fft algorithms for DIF and dit are written.
For ease of programming, dit and DIF are used to sort the input in the descending order, and to sort the output in the natural order. For the latter, the input is in the natural order and the output is in the descending order.
The difficulty is the descending order algorithm and the FFT loop algorithm.
Below is the simplest sequence with an integer power of 2
1. Descending Order algorithm, both of which are common.
(1) Break half and then join, break half, and then join, knowing that the column vector is a row vector
This reflects the essence of inverted order.
I can only think of loops:
x=[1:8]';
L=length(x);
for i=1:1:log2(L) L=L/2; y=mat2cell(x,[L,L]); y=reshape(y,1,2); x=cell2mat(y);end
I asked Daniel, without loops. The MATLAB functions are:
Method 1:
N = 3;
A = (1:8 )';
Y = permute (reshape (A, 2 * ones (1, N), N:-1:1 );
Y (:).' |
Method 2:
N = 4;
P (^ N, N:-) = dec2bin (0 :( 2 ^ N-1 ));
Re = bin2dec (char (p) + 1;
Re |
The second method is to say that every time one half is broken and then put together, we want to shift right to the number of subscripts
That is, 000 => 000,001 => 100,010 => 010,011... similar to this.
(2) As for loops, the relationship between them is used.
The relationship between P and Level A and level K is described in the book. Considering the hardware equipment cost, it is found that the subscript of the product sum of each two of each level is irrelevant to the other two, therefore, you do not need to introduce other hardware devices.
X (K) = x (k) + x (K + B) e ^ (-J * 2 * π/N * P );
X (K + B) = x (k)-X (K + B) e ^ (-J * 2 * π/N * P );
During programming, note that X (k) needs to be re-assigned to other letters, otherwise it will cause confusion errors, that is
Mid = x (k)
X (K) = Mid + x (K + B) e ^ (-J * 2 * π/N * P );
X (K + B) = mid-X (K + B) e ^ (-J * 2 * π/N * P)
The above three statements are the core, and other loops are nothing more than finding the relationship between various K, P, N and other parameters!
(3) I finally stressed that the problem has been fixed for a long time,Transpose of the complex number and the real number (the complex number transpose cannot use x', it must use X .')Remember!