Changes between Version 16 and Version 17 of SpectraObject


Ignore:
Timestamp:
01/13/15 12:43:53 (10 years ago)
Author:
Jonathan
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • SpectraObject

    v16 v17  
    9191
    9292== What does the Spectra calculate? ==
    93 The Spectra performs a DFT on whatever fields  are assigned to it.  The discrete FFT is defined as
     93 First we must understand what the FFT calculates
    9494
    95 [[latex($F_k=\displaystyle \sum_{x=1}^{N_x} e^{  \frac{2 \pi i}{N_x} k x} f_{x}$)]]
     95=== What does the FFT calculate ===
     96The FFT performs a Discrete Fourier Transform (DFT) which is defined as
     97
     98[[latex($F_k=\displaystyle \sum_{x=1}^{N} e^{  \frac{2 \pi i}{N} k x} f_{x}$)]]
    9699
    97100where [[latex($k$)]] is any integer. 
    98101
    99 Now [[latex($F_k$)]] is periodic in [[latex($k$)]] since
     102We can see how this corresponds to a real fourier transform by making the substitutions [[latex($x'=x \Delta x$)]], [[latex($k'=k \Delta k $)]], [[latex($\Delta k = \frac{2 \pi}{L}$)]]  and [[latex($N=\frac{L}{\Delta x}$)]] and take the limit as [[latex($\Delta x \rightarrow 0$)]] 
     103
     104[[latex($F(k')= \frac{N}{L}\displaystyle \int_{x'=0}^{L} e^{ik' x'} f(x') dx$)]]
     105
     106So that the DFT corresponds to a fourier transform where the physical wavelength is normalized by [[latex($\Delta k=\frac{2 \pi}{L}$)]] and the magnitude is normalized by [[latex($N/L$)]]
     107
     108
     109Now the FFT returns the array of transforms with [[latex($k=[0,1,2,...,N_x-1]$)]]
     110
     111However, [[latex($F_k$)]] is periodic in [[latex($k$)]] since
    100112
    101113[[latex($F_{k+N_x}=\displaystyle \sum_{x=1}^{N_x} e^{  \frac{2 \pi i}{N_x} \left(k+N_x\right) x} f_{x} = \displaystyle \sum_{x=1}^{N_x} e^{2 \pi i x} \times e^{  \frac{2 \pi i}{N_x} k x} f_{x}=\displaystyle \sum_{x=1}^{N_x} e^{  \frac{2 \pi i}{N_x} kx} f_{x}  =F_k$)]]
    102114
    103 We can visually see this by plotting the discrete sampling of the real part of the continuous functions for [[latex($k=1$)]] and [[latex($k=11$)]] for a grid where [[latex($N_x=10$)]]
     115We can visually see this by plotting the discrete sampling of the real part of the continuous functions for [[latex($k=-1$)]] and [[latex($k=9$)]] for a grid where [[latex($N_x=10$)]]
    104116
    105 [[Image(Screen Shot 2015-01-13 at 10.49.34 AM.png​​,width=600)]]
     117[[Image(Screen Shot 2015-01-13 at 10.57.02 AM.png​​,width=600)]]
    106118
     119So we can interpret [[latex($F_9$)]] as representing a signal with wavenumber $9$ or $-1$, or $-11$.  Since we don't expect there to be signals in our data at frequencies above the Nyquist frequency - it is logical to assume that [[latex($F_9$)]] corresponds to a signal with [[latex($k=-1$)]].
    107120
    108 Now the DFT returns the array of transforms with [[latex($k=[0,1,2,...,N_x-1]$)]]
     121Mathematically this means that if [[latex($k > N/2$)]] then  [[latex($k \rightarrow k-N$)]] or equivalently  [[latex($k \rightarrow \left [ \left ( k+N/2 \right ) \bmod N \right ]- N/2 $)]]
    109122
    110 [[latex($F_k=\displaystyle \sum_{x=1}^{N_x} e^{  \frac{2 \pi i}{N_x} k x} f_{x}$)]]
     123This is why we call the resulting FFT array to be in wrap around order.   That is, the array returned by the FFT corresponds to normalized wavenumbers of $$[0,1,2,...,N/2,-N/2+1,-N/2+2,...,-2,-1]$$
    111124
    112 but we can interpret [[latex($F_N
     125Or if we index the FFT array starting at 1, and then plot the index of each component on the corresponding grid in k space we get
    113126
    114 so while we can calculate the transform for any k, only N of them will be unique.
    115 
    116 [[latex($F_l=\displaystyle \sum_{l'=1}^{N_x} e^{  \frac{2 \pi i}{N_x} (l-1) (l'-1)} f_{l'}$)]]
    117 
    118 Here we are using [[latex($j-1$)]] and [[latex($j'-1$)]] because indices in Fortran start at 1.
    119 
    120 Well if we make the substitutions [[latex($x=(l'-1) \Delta x$)]], [[latex($N_x=\frac{L_x}{\Delta x}$)]] and [[latex($k_x=(l-1)\frac{2\pi}{L}=(l-1) \Delta k $)]] and take the limit as [[latex($\Delta X \rightarrow 0$)]] we see that
    121 
    122 [[latex($F(k_x)= \frac{N_x}{L}\displaystyle \int_{x=0}^{L} e^{ik_x x} f(x) dx$)]]
    123 
    124 The discrete FFT projects the function onto the basis set [[latex($\{e^{i (l-1)\Delta k}:l=1,N_x\}$)]]
    125 
    126 Here are the real parts of the continuous versions of those functions for N_x=10
    127 
    128 [[Image(Screen Shot 2015-01-06 at 3.31.14 PM.png​,width=600)]]
    129 
    130 And here is the real part of the discrete form of those same functions.  Note that there are only 6 lines visible!
    131 
    132 [[Image(Screen Shot 2015-01-06 at 3.08.22 PM.png​,width=600)]]
    133 
    134 
    135 The real part of the discrete function for l = 2 and l = 10 are coincident! As are 3 and 9, 4 and 8, 5 and 7. 
    136 
    137 
    138 What about the imaginary parts?
    139 
    140 [[Image(Screen Shot 2015-01-06 at 4.28.36 PM.png​,width=600)]]
    141 
    142 The imaginary parts are different - but only in sign!
    143 
    144 We can see how this happens if we compare [[latex($F_l$)]] and [[latex($F_{N_x+2-l}$)]]
    145 
    146 [[latex($F_{N_x+2-l}=\displaystyle \sum_{l'=1}^{N_x} e^{  \frac{2 \pi i}{N_x} (N_x+2-l-1) (l'-1)} f_{l'}=\displaystyle \sum_{l'=1}^{N_x} e^{  \frac{2 \pi i}{N_x} ((-(l-1)) (l'-1)} f_{l'}=F_l^*$)]]
    147 
    148 but [[latex($F_{N_x+2-l}=\displaystyle \sum_{l'=1}^{N_x} e^{  \frac{2 \pi i}{N_x} ((-(l-1)) (l'-1)} f_{l'}$)]]
    149 
    150 corresponds to [[latex($F(-k_x)= \frac{N_x}{L}\displaystyle \int_{x=0}^{L} e^{i-k_x x} f(x) dx$)]]