multi dimensional indexing fft
play

Multi-Dimensional Indexing: FFT Use a transform to generate an index - PowerPoint PPT Presentation

Multi-Dimensional Indexing: FFT Use a transform to generate an index pattern that still contains all values in the range (0 to N-1). Size N n takes on values of n: 0, 1, 2, 3, ... N-2, N-1 or N, 1+N, 2+N, 3+N, ... 2N-2, 2N-1


  1. Multi-Dimensional Indexing: FFT • Use a transform to generate an index pattern that still contains all values in the range (0 to N-1). • Size N • n takes on values of n: 0, 1, 2, 3, ... N-2, N-1 or N, 1+N, 2+N, 3+N, ... 2N-2, 2N-1 • Use 2 variables n 1 and n 2 . • Rewrite n = (An 1 + Bn 2 ) mod N n 1 : 0, 1, 2, 3, ... N 1 -2, N 1 -1 n 2 : 0, 1, 2, 3, ... N 2 -2, N 2 -1 where N=N 1 N 2

  2. N-Point complex DFT (even) done CORDIC or Cos -k W N n-counter k-counter Sin ROM Concat I&Q concat I&Q Data In Data Out rst z -1 Memory Memory addr ena

  3. Matlab Example N = 30, N1=5, N2=6 n1 = ones(6,1)*(0:4); 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 n2 = (ones(5,1)*( 0:5))’; 0 0 0 0 0 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 n = N2*n1 + n2; 0 6 12 18 24 1 7 13 19 25 2 8 14 20 26 3 9 15 21 27 4 10 16 22 28 5 11 17 23 29

  4. Do the same thing for k.

  5. Matlab Example N = 30, N1=5, N2=6 N = 30, N1=5, N2=6 n1 = ones(6,1)*(0:4); k1 = ones(6,1)*(0:4); 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 n2 = (ones(5,1)*( 0:5))’; k 2 = (ones(5,1)*(0:5))’; 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 n = N2*n1 + n2; k = k1 + N1*k2; 0 6 12 18 24 0 1 2 3 4 1 7 13 19 25 5 6 7 8 9 2 8 14 20 26 10 11 12 13 14 3 9 15 21 27 15 16 17 18 19 4 10 16 22 28 20 21 22 23 24 5 11 17 23 29 25 26 27 28 29

  6. Multi-Dimensional Indexing 𝑂−1 𝑜𝑙 𝑌 𝑙 = ෍ 𝑦 𝑜 𝑋 𝑂 𝑜=0 Replace n and k. 𝑂 2 −1 𝑂 1 −1 𝑂 2 𝑜 1 +𝑜 2 𝑙 1 +𝑂 1 𝑙 2 𝑌 𝑙 1 + 𝑂 1 𝑙 2 = ෍ ෍ 𝑦 𝑂 2 𝑜 1 + 𝑜 2 𝑋 𝑂 𝑜 2 =0 𝑜 1 =0 Multiply terms 𝑂 2 −1 𝑂 1 −1 𝑂 2 𝑜 1 𝑙 1 +𝑂 1 𝑂 2 𝑜 1 𝑙 2 +𝑜 2 𝑙 1 +𝑂 1 𝑜 2 𝑙 2 𝑌 𝑙 1 + 𝑂 1 𝑙 2 = ෍ ෍ 𝑦 𝑂 2 𝑜 1 + 𝑜 2 𝑋 𝑂 𝑜 2 =0 𝑜 1 =0 Eliminate N 1 N 2 =N term 𝑂 2 −1 𝑂 1 −1 𝑂 2 𝑜 1 𝑙 1 +𝑜 2 𝑙 1 +𝑂 1 𝑜 2 𝑙 2 𝑌 𝑙 1 + 𝑂 1 𝑙 2 = ෍ ෍ 𝑦 𝑂 2 𝑜 1 + 𝑜 2 𝑋 𝑂 𝑜 2 =0 𝑜 1 =0

  7. Multi-Dimensional Indexing 𝑂 2 −1 𝑂 1 −1 𝑂 2 𝑜 1 𝑙 1 +𝑜 2 𝑙 1 +𝑂 1 𝑜 2 𝑙 2 𝑌 𝑙 1 + 𝑂 1 𝑙 2 = ෍ ෍ 𝑦 𝑂 2 𝑜 1 + 𝑜 2 𝑋 𝑂 𝑜 2 =0 𝑜 1 =0 Move out of summation. 𝑂 2 −1 𝑂 1 −1 𝑜 2 𝑙 1 ෍ 𝑂 1 𝑜 2 𝑙 2 𝑋 𝑂 2 𝑜 1 𝑙 1 𝑌 𝑙 1 + 𝑂 1 𝑙 2 = ෍ 𝑋 𝑦 𝑂 2 𝑜 1 + 𝑜 2 𝑋 𝑂 𝑂 𝑂 𝑜 2 =0 𝑜 1 =0 Finally group terms. 𝑂 2 −1 𝑂 1 −1 𝑜 2 𝑙 1 𝑜 1 𝑙 1 𝑜 2 𝑙 2 𝑌 𝑙 1 + 𝑂 1 𝑙 2 = ෍ 𝑋 ෍ 𝑦 𝑂 2 𝑜 1 + 𝑜 2 𝑋 𝑋 𝑂 𝑂 1 𝑂 2 𝑜 2 =0 𝑜 1 =0

  8. Interpretation 𝑂 2 −1 𝑂 1 −1 𝑜 2 𝑙 1 𝑜 1 𝑙 1 𝑜 2 𝑙 2 𝑌 𝑙 1 + 𝑂 1 𝑙 2 = ෍ 𝑋 ෍ 𝑦 𝑂 2 𝑜 1 + 𝑜 2 𝑋 𝑋 𝑂 𝑂 1 𝑂 2 𝑜 2 =0 𝑜 1 =0 • For each n 2 from 0 to N 2 -1, perform an N 1 point DFT over values of (see next slide): • DFT across rows. x(n = [(0)N 2 ,(1)N 2 ,(2)N 2 ,...,(N 1 -1)N 2 ]+0 )→ x[n 2 =0, k 1 =0:N 1 -1] x(n = [(0)N 2 ,(1)N 2 ,(2)N 2 ,...,(N 1 -1)N 2 ]+1 )→ x[n 2 =1, k 1 =0:N 1 -1] x(n = [(0)N 2 ,(1)N 2 ,(2)N 2 ,...,(N 1 -1)N 2 ]+2 )→ x[n 2 =2, k 1 =0:N 1 -1] ... x(n = [(0)N 2 ,(1)N 2 ,(2)N 2 ,...,(N 1 -1)N 2 ]+N 2 - 1)→ x[n 2 =N 2 -1,k 1 =0:N 1 -1] • Multiply each intermediate term accorking to k 1 &n 2 .

  9. Matlab Example N = 30, N1=5, N2=6 N = 30, N1=5, N2=6 n1 = ones(6,1)*(0:4); k1 = ones(6,1)*(0:4); 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 n2 = (ones(5,1)*( 0:5))’; k 2 = (ones(5,1)*(0:5))’; 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 n = N2*n1 + n2; k = k1 + N1*k2; 0 6 12 18 24 0 1 2 3 4 1 7 13 19 25 5 6 7 8 9 2 8 14 20 26 10 11 12 13 14 3 9 15 21 27 15 16 17 18 19 4 10 16 22 28 20 21 22 23 24 5 11 17 23 29 25 26 27 28 29

  10. Interpretation 𝑂 2 −1 𝑂 1 −1 𝑜 2 𝑙 1 𝑜 1 𝑙 1 𝑜 2 𝑙 2 𝑌 𝑙 1 + 𝑂 1 𝑙 2 = ෍ 𝑋 ෍ 𝑦 𝑂 2 𝑜 1 + 𝑜 2 𝑋 𝑋 𝑂 𝑂 1 𝑂 2 𝑜 2 =0 𝑜 1 =0 • For each k 1 from 0 to N 1 -1, perform an N 2 point DFT over values of: • DFT across columns. x[n2=0:N 2 -1,k 1 =0 ] → X[k 2 =0:N 2 -1,k 1 =0 ] x[n2=0:N 2 -1,k 1 =1 ] → X[k 2 =0:N 2 -1,k 1 =1 ] x[n2=0:N 2 -1,k 1 =2 ] → X[k 2 =0:N 2 -1,k 1 =2 ] ... x[n2=0:N 2 -1,k 1 =N 1 -1] → X[k 2 =0:N 2 -1,k 1 =N 1 -1] • Re-order the results.

  11. Matlab Example N = 30, N1=5, N2=6 N = 30, N1=5, N2=6 n1 = ones(6,1)*(0:4); k1 = ones(6,1)*(0:4); 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 n2 = (ones(5,1)*( 0:5))’; k 2 = (ones(5,1)*(0:5))’; 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 n = N2*n1 + n2; k = k1 + N1*k2; 0 6 12 18 24 0 1 2 3 4 1 7 13 19 25 5 6 7 8 9 2 8 14 20 26 10 11 12 13 14 3 9 15 21 27 15 16 17 18 19 4 10 16 22 28 20 21 22 23 24 5 11 17 23 29 25 26 27 28 29

  12. Matlab Example N = 30, N1=5, N2=6 n1 = ones(6,1)*(0:4); n = N2*n1 + n2; 0 1 2 3 4 x(n1,n2=0) = x(0) x(6) x(12) x(18) x(24) 0 1 2 3 4 x(n1,n2=1) = x(1) x(7) x(13) x(19) x(25) 0 1 2 3 4 x(n1,n2=2) = x(2) x(8) x(14) x(20) x(26) 0 1 2 3 4 x(n1,n2=3) = x(3) x(9) x(15) x(21) x(27) 0 1 2 3 4 x(n1,n2=4) = x(4) x(10) x(16) x(22) x(28) 0 1 2 3 4 x(n1,n2=5) = x(5) x(11) x(17) x(23) x(29) Perform N2 DFTs along n1 n2 = (ones(5,1)*( 0:5))’; k1 = 0 1 2 3 4 0 0 0 0 0 y(k1,n2=0) = fft(x(0) x(6) x(12) x(18) x(24)) 1 1 1 1 1 y(k1,n2=1) = fft(x(1) x(7) x(13) x(19) x(25)) 2 2 2 2 2 y(k1,n2=2) = fft(x(2) x(8) x(14) x(20) x(26)) 3 3 3 3 3 y(k1,n2=3) = fft(x(3) x(9) x(15) x(21) x(27)) 4 4 4 4 4 y(k1,n2=4) = fft(x(4) x(10) x(16) x(22) x(28)) 5 5 5 5 5 y(k1,n2=5) = fft(x(5) x(11) x(17) x(23) x(29)) Multiply n = N2*n1 + n2; k1 = 0 1 2 3 4 0 6 12 18 24 n2=0 = W0 W0 W0 W0 W0 1 7 13 19 25 n2=1 = W0 W1 W2 W3 W4 2 8 14 20 26 n2=2 = W0 W2 W4 W6 W8 3 9 15 21 27 n2=3 = W0 W3 W6 W9 W12 4 10 16 22 28 n2=4 = W0 W4 W8 W12 W16 5 11 17 23 29 n2=5 = W0 W5 W10 W15 W20

  13. Matlab Example Multiply N = 30, N1=5, N2=6 k1 = 0 1 2 3 4 n2=0 = W0y00 W0y10 W0y20 W0y30 W0y40 k1 = ones(6,1)*(0:4); n2=1 = W0y01 W1y11 W2y21 W3y31 W4y41 0 1 2 3 4 n2=2 = W0y02 W2y12 W4y22 W6y32 W8y42 0 1 2 3 4 n2=3 = W0y03 W3y13 W6y23 W9y33 W12y43 0 1 2 3 4 n2=4 = W0y04 W4y14 W8y24 W12y34 W16y44 0 1 2 3 4 n2=5 = W0y05 W5y15 W10y25 W15y35 W20y45 0 1 2 3 4 0 1 2 3 4 fft along columns k1 = 0 1 2 3 4 k 2 = (ones(5,1)*(0:5))’; k2=0 = z00 z10 z20 z30 z40 0 0 0 0 0 k2=1 = z01 z11 z21 z31 z41 1 1 1 1 1 k2=2 = z02 z12 z22 z32 z42 2 2 2 2 2 k2=3 = z03 z13 z23 z33 z43 3 3 3 3 3 k2=4 = z04 z14 z24 z34 z44 4 4 4 4 4 k2=5 = z05 z15 z25 z35 z45 5 5 5 5 5 Reorder based on k = k1 + N1*k2; k = k1 + N1*k2; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29

Recommend


More recommend