Difference between revisions of "Signal Representation/Fast Fourier Transform (FFT)"

From LNTwww
Line 1: Line 1:
 
{{LastPage}}
 
{{LastPage}}
 
{{Header
 
{{Header
|Untermenü=Zeit- und frequenzdiskrete Signaldarstellung
+
|Untermenü=Time and Frequency-Discrete Signal Representation
|Vorherige Seite=Spektralanalyse
+
|Vorherige Seite=Spectrum Analysis
 
|Nächste Seite=
 
|Nächste Seite=
 
}}
 
}}
  
==Rechenaufwand von DFT bzw. IDFT==   
+
==Complexity of DFT and IDFT==   
 
<br>
 
<br>
Ein Nachteil der direkten Berechnung der (im Allgemeinen komplexen) DFT–Zahlenfolgen
+
A disadvantage of the direct calculation of the (generally complex) DFT number sequences
  
 
:$$\langle \hspace{0.1cm}D(\mu)\hspace{0.1cm}\rangle  \hspace{0.2cm}\bullet\!\!-\!\!\!-(N)\!-\!\!\!-\!\!\hspace{0.05cm}\circ\, \hspace{0.2cm} \langle \hspace{0.1cm}d(\nu)\hspace{0.1cm} \rangle$$
 
:$$\langle \hspace{0.1cm}D(\mu)\hspace{0.1cm}\rangle  \hspace{0.2cm}\bullet\!\!-\!\!\!-(N)\!-\!\!\!-\!\!\hspace{0.05cm}\circ\, \hspace{0.2cm} \langle \hspace{0.1cm}d(\nu)\hspace{0.1cm} \rangle$$
 
   
 
   
gemäß den in Kapitel&nbsp; [[Signal_Representation/Discrete_Fourier_Transform_(DFT)|Diskrete Fouriertransformation (DFT)]]&nbsp; angegebenen Gleichungen ist der große RechenaufwandWir betrachten als Beispiel  die DFT, also die Berechnung der&nbsp; $D(\mu)$&nbsp; aus den&nbsp; $d(\nu)$:
+
according to the equations given in chapter&nbsp; [[Signal_Representation/Discrete_Fourier_Transform_(DFT)|Discrete Fourier Transform (DFT)]]&nbsp;is the large computational costWe consider as an example the DFT, i.e. the calculation of the&nbsp; $D(\mu)$&nbsp; from the&nbsp; $d(\nu)$:
 
   
 
   
 
:$$N \cdot D(\mu)  =  \sum_{\nu = 0 }^{N-1}
 
:$$N \cdot D(\mu)  =  \sum_{\nu = 0 }^{N-1}
Line 19: Line 19:
 
   d(0) \cdot w^{\hspace{0.03cm}0} + d(1) \cdot w^{\hspace{0.03cm}\mu}+ d(2) \cdot w^{\hspace{0.03cm}2\mu}+\hspace{0.05cm}\text{ ...} \hspace{0.05cm}+ d(N-1) \cdot w^{\hspace{0.03cm}(N-1)\cdot \mu}$$
 
   d(0) \cdot w^{\hspace{0.03cm}0} + d(1) \cdot w^{\hspace{0.03cm}\mu}+ d(2) \cdot w^{\hspace{0.03cm}2\mu}+\hspace{0.05cm}\text{ ...} \hspace{0.05cm}+ d(N-1) \cdot w^{\hspace{0.03cm}(N-1)\cdot \mu}$$
  
Der hierfür erforderliche Rechenaufwand soll abgeschätzt werden, wobei wir davon ausgehen, dass die Potenzen des komplexen Drehfaktors&nbsp; $w = {\rm e}^{-{\rm j} \hspace{0.05cm}\cdot \hspace{0.05cm}2 \pi/N}$&nbsp; bereits in Real– und Imaginärteilform in einer Lookup–Tabelle vorliegen. Zur Berechnung eines einzelnen Koeffizienten benötigt man dann&nbsp; $N-1$&nbsp; komplexe Multiplikationen und ebenso viele komplexe Additionen, wobei zu beachten ist:  
+
The computational effort required for this is to be estimated, assuming that the powers of the complex rotation factor&nbsp; $w = {\rm e}^{-{\rm j} \hspace{0.05cm}\cdot \hspace{0.05cm}2 \pi/N}$&nbsp; already exist in real and imaginary part form in a lookup table. To calculate a single coefficient, one then needs&nbsp; $N-1$&nbsp; complex multiplications and as many complex additions, observing:  
*Jede komplexe Addition erfordert zwei reelle Additionen:
+
*Each complex addition requires two real additions:
 
:$$(R_1 + {\rm j} \cdot I_1) + (R_2 + {\rm j} \cdot I_2) = (R_1 +
 
:$$(R_1 + {\rm j} \cdot I_1) + (R_2 + {\rm j} \cdot I_2) = (R_1 +
 
R_2) + {\rm j} \cdot (I_1 + I_2)\hspace{0.05cm}.$$  
 
R_2) + {\rm j} \cdot (I_1 + I_2)\hspace{0.05cm}.$$  
*Jede komplexe Multiplikation erfordert vier reelle Multiplikationen und zwei reelle Additionen (eine Subtraktion wird wie eine Addition behandelt):
+
*Each complex multiplication requires four real multiplications and two real additions (a subtraction is treated as an addition):
 
:$$(R_1 + {\rm j} \cdot I_1)  (R_2 + {\rm j} \cdot I_2) = (R_1 \cdot
 
:$$(R_1 + {\rm j} \cdot I_1)  (R_2 + {\rm j} \cdot I_2) = (R_1 \cdot
 
R_2 - I_1 \cdot I_2) + {\rm j} \cdot (R_1 \cdot I_2 + R_2 \cdot
 
R_2 - I_1 \cdot I_2) + {\rm j} \cdot (R_1 \cdot I_2 + R_2 \cdot
 
I_1)\hspace{0.05cm}.$$  
 
I_1)\hspace{0.05cm}.$$  
*Somit sind zur Berechnung aller&nbsp; $N$&nbsp; Koeffizienten insgesamt die folgende Anzahl&nbsp; $M$&nbsp; reeller Multiplikationen und die Anzahl&nbsp; $A$&nbsp; reeller Additionen erforderlich:
+
*Thus, the following number of real multiplications and the number of real additions are required to calculate all $N$ coefficients in total:
 
:$$M = 4 \cdot N \cdot (N-1),$$
 
:$$M = 4 \cdot N \cdot (N-1),$$
 
:$$A = 2 \cdot N \cdot
 
:$$A = 2 \cdot N \cdot
 
(N-1)+2 \cdot N \cdot (N-1)=M \hspace{0.05cm}.$$  
 
(N-1)+2 \cdot N \cdot (N-1)=M \hspace{0.05cm}.$$  
*In heutigen Rechnern benötigen Multiplikationen und Additionen/Subtraktionen etwa die gleiche Rechenzeit. Es genügt, die Gesamtzahl&nbsp; $\mathcal{O} = M + A$&nbsp; aller Operationen zu betrachten:
+
*In today's computers, multiplications and additions/subtractions need about the same computing time. It is sufficient to consider the total number&nbsp; $\mathcal{O} = M + A$&nbsp; of all operations:
 
:$$\mathcal{O} = 8 \cdot N \cdot (N-1) \approx 8 \cdot N^2\hspace{0.05cm}.$$  
 
:$$\mathcal{O} = 8 \cdot N \cdot (N-1) \approx 8 \cdot N^2\hspace{0.05cm}.$$  
  
 
{{BlaueBox|TEXT=
 
{{BlaueBox|TEXT=
$\text{Fazit:}$&nbsp;  
+
$\text{Conclusion:}$&nbsp;  
*Man benötigt bereits für eine&nbsp; ''Diskrete Fouriertransformation''&nbsp; (DFT) mit&nbsp; $N = 1000$&nbsp; knapp acht Millionen Rechenoperationen. Gleiches gilt für eine IDFT.  
+
*For a&nbsp; ''Discrete Fourier Transform''&nbsp; (DFT) with&nbsp; $N = 1000$&nbsp; one already needs almost eight million arithmetic operations. The same applies to an IDFT.  
*Mit&nbsp; $N =16 $&nbsp; sind immerhin noch &nbsp;$1920$&nbsp; Rechenoperationen erforderlich.}}
+
*With&nbsp; $N =16$&nbsp; still &nbsp;$1920$&nbsp; computational operations are required}}.
  
  
Ist der Parameter&nbsp; $N$&nbsp; eine Potenz zur Basis&nbsp; $2$, so können rechenzeitgünstigere Algorithmen angewendet werden. Die Vielzahl solcher aus der Literatur bekannten Verfahren werden unter dem Sammelbegriff&nbsp; '''Fast–Fouriertransformation'''&nbsp; – abgekürzt&nbsp; '''FFT'''&nbsp; – zusammengefasst. Alle diese Methoden basieren auf dem Überlagerungssatz der DFT.
+
If the parameter&nbsp; $N$&nbsp; is a power to the base&nbsp; $2$, more computationally efficient algorithms can be applied. The multitude of such methods known from the literature are summarised under the collective term&nbsp; '''Fast Fourier Transform'''&nbsp; - abbreviated&nbsp; '''FFT'''&nbsp; -. All these methods are based on the superposition theorem of the DFT.
 
   
 
   
==Überlagerungssatz der DFT==   
+
==Superposition Theorem of the DFT==   
 
<br>
 
<br>
Die Grafik verdeutlicht den so genannten Überlagerungssatz der DFT am Beispiel&nbsp; $N = 16$. Dargestellt ist hier der Übergang vom Zeit&ndash; in den Spektralbereich, also die Berechnung der Spektralbereichskoeffizienten aus den Zeitbereichskoeffizienten: &nbsp;    $\langle \hspace{0.1cm}D(\mu)\hspace{0.1cm}\rangle  \hspace{0.2cm}\bullet\!\!-\!\!\!-(N)\!-\!\!\!-\!\!\hspace{0.05cm}\circ\, \hspace{0.2cm} \langle \hspace{0.1cm} d(\nu) \hspace{0.1cm}\rangle.$
+
The graph illustrates the so-called superposition theorem of the DFT using the example of $N = 16$. Shown here is the transition from the time domain to the spectral domain, i.e. the calculation of the spectral domain coefficients from the time domain coefficients: &nbsp;    $\langle \hspace{0.1cm}D(\mu)\hspace{0.1cm}\rangle  \hspace{0.2cm}\bullet\!\!-\!\!\!-(N)\!-\!\!\!-\!\!\hspace{0.05cm}\circ\, \hspace{0.2cm} \langle \hspace{0.1cm} d(\nu) \hspace{0.1cm}\rangle.$
  
[[File:EN_Sig_T_5_5_S2.png|center|frame|Überlagerungssatz der DFT]]
+
[[File:EN_Sig_T_5_5_S2.png|center|frame|Superposition Theorem of the DFT]]
  
Der dadurch beschriebene Algorithmus ist durch folgende Schritte gekennzeichnet:
+
The algorithm described thereby is characterised by the following steps:
*Die Folge&nbsp; $\langle \hspace{0.1cm}d(\nu)\hspace{0.1cm}\rangle$&nbsp; der Länge&nbsp; $N$&nbsp; wird in zwei Teilfolgen&nbsp; $\langle \hspace{0.1cm}d_1(\nu)\hspace{0.1cm}\rangle$&nbsp; und&nbsp; $\langle \hspace{0.1cm} d_2(\nu)\hspace{0.1cm}\rangle$&nbsp; jeweils halber Länge separiert (in der Garafik gelb bzw. grün hinterlegt). Mit&nbsp; $0 \le \nu \lt N/2$&nbsp; erhält man so die Folgenelemente
+
*The sequence&nbsp; $\langle \hspace{0.1cm}d(\nu)\hspace{0.1cm}\rangle$&nbsp; of length&nbsp; $N$&nbsp; is divided into two subsequences$\langle \hspace{0.1cm} d_1(\nu)\hspace{0.1cm}\rangle$&nbsp; and&nbsp; $\langle \hspace{0.1cm} d_2(\nu)\hspace{0.1cm}\rangle$&nbsp; each of half length (highlighted in yellow and green respectively in the garafic). With&nbsp; $0 \le \nu \lt N/2$&nbsp; one thus obtains the sequence elements
 
:$$d_1(\nu) = d(2\nu), $$
 
:$$d_1(\nu) = d(2\nu), $$
 
:$$d_2(\nu) = d(2\nu+1)
 
:$$d_2(\nu) = d(2\nu+1)
 
\hspace{0.05cm}.$$
 
\hspace{0.05cm}.$$
*Die Ausgangsfolgen&nbsp; $\langle \hspace{0.1cm}D_1(\mu )\hspace{0.1cm}\rangle$&nbsp; und&nbsp; $\langle \hspace{0.1cm}D_2(\mu )\hspace{0.1cm}\rangle$&nbsp; der beiden Teilblöcke ergeben sich daraus jeweils durch eine eigene DFT, aber nun nur noch mit halber Länge&nbsp; $N/2 = 8$:
+
*The initial sequences&nbsp; $\langle \hspace{0.1cm}D_1(\mu )\hspace{0.1cm}\rangle$&nbsp; and&nbsp; $\langle \hspace{0.1cm}D_2(\mu )\hspace{0.1cm}\rangle$&nbsp; of the two sub-blocks result from this each by its own DFT, but now only with half length&nbsp; $N/2 = 8$:
 
:$$\langle \hspace{0.1cm}D_1(\mu) \hspace{0.1cm}\rangle  \hspace{0.2cm}\bullet\!\!-\!\!\!-(N/2)\!-\!\!\!-\!\!\hspace{0.05cm}\circ\, \hspace{0.2cm} \langle \hspace{0.1cm}d_1(\nu) \hspace{0.1cm}\rangle , $$
 
:$$\langle \hspace{0.1cm}D_1(\mu) \hspace{0.1cm}\rangle  \hspace{0.2cm}\bullet\!\!-\!\!\!-(N/2)\!-\!\!\!-\!\!\hspace{0.05cm}\circ\, \hspace{0.2cm} \langle \hspace{0.1cm}d_1(\nu) \hspace{0.1cm}\rangle , $$
 
:$$ \langle \hspace{0.1cm}D_2(\mu)\hspace{0.1cm} \rangle \hspace{0.2cm}\bullet\!\!-\!\!\!-(N/2)\!-\!\!\!-\!\!\hspace{0.05cm}\circ\, \hspace{0.2cm} \langle \hspace{0.1cm}d_2(\nu) \hspace{0.1cm}\rangle \hspace{0.05cm}.$$  
 
:$$ \langle \hspace{0.1cm}D_2(\mu)\hspace{0.1cm} \rangle \hspace{0.2cm}\bullet\!\!-\!\!\!-(N/2)\!-\!\!\!-\!\!\hspace{0.05cm}\circ\, \hspace{0.2cm} \langle \hspace{0.1cm}d_2(\nu) \hspace{0.1cm}\rangle \hspace{0.05cm}.$$  
*Die Ausgangswerte&nbsp; $\langle \hspace{0.1cm} D_2(\mu )\hspace{0.1cm}\rangle$&nbsp; der unteren (grünen) DFT $($mit&nbsp; $0 \le \mu \lt N/2)$&nbsp; werden danach im rot umrandeten Block durch komplexe Drehfaktoren hinsichtlich der Phasenlage verändert:
+
*The initial values&nbsp; $\langle \hspace{0.1cm} D_2(\mu )\hspace{0.1cm}\rangle$&nbsp; of the lower (green) DFT $($with&nbsp; $0 \le \mu \lt N/2)$&nbsp; are then changed in the block outlined in red by complex rotation factors with respect to phase:
 
:$$D_2(\mu) \hspace{0.3cm} \Rightarrow \hspace{0.3cm}D_2(\mu) \cdot w^{\hspace{0.04cm}\mu}, \hspace{0.2cm}{\rm wobei}\hspace{0.1cm}w =
 
:$$D_2(\mu) \hspace{0.3cm} \Rightarrow \hspace{0.3cm}D_2(\mu) \cdot w^{\hspace{0.04cm}\mu}, \hspace{0.2cm}{\rm wobei}\hspace{0.1cm}w =
 
  {\rm e}^{-{\rm j} \hspace{0.05cm}\cdot \hspace{0.05cm}2 \pi/N} \hspace{0.05cm}.$$  
 
  {\rm e}^{-{\rm j} \hspace{0.05cm}\cdot \hspace{0.05cm}2 \pi/N} \hspace{0.05cm}.$$  
*Jeder einzelne&nbsp; '''Butterfly'''&nbsp; im blau umrandeten Block (in der Grafikmitte) liefert durch Addition bzw. Subtraktion zwei Elemente der gesuchten Ausgangsfolge. Mit&nbsp; $0 \le \mu \lt N/2$&nbsp; gilt dabei:
+
*Each single&nbsp; '''Butterfly'''&nbsp; in the blue bordered block (in the middle of the graph) yields two elements of the searched sequence by addition or subtraction. With&nbsp; $0 \le \mu \lt N/2$&nbsp; applies:
 
:$$D(\mu) =  {1}/{2}\cdot \big[D_1(\mu) + D_2(\mu) \cdot w^{\hspace{0.04cm}\mu}\big],$$
 
:$$D(\mu) =  {1}/{2}\cdot \big[D_1(\mu) + D_2(\mu) \cdot w^{\hspace{0.04cm}\mu}\big],$$
 
:$$D(\mu +{N}/{2})  =  {1}/{2}\cdot \big[D_1(\mu) - D_2(\mu) \cdot w^{\hspace{0.04cm}\mu}\big]\hspace{0.05cm}.$$  
 
:$$D(\mu +{N}/{2})  =  {1}/{2}\cdot \big[D_1(\mu) - D_2(\mu) \cdot w^{\hspace{0.04cm}\mu}\big]\hspace{0.05cm}.$$  
  
Durch&nbsp; '''diese erste Anwendung des Überlagerungssatzes halbiert sich somit in etwa der Rechenaufwand'''.
+
'''This first application of the superposition theorem thus roughly halves the computational effort.'''
  
 
{{GraueBox|TEXT=   
 
{{GraueBox|TEXT=   
$\text{Beispiel 1:}$&nbsp;
+
$\text{Example 1:}$&nbsp;
Die DFT–Koeffizienten&nbsp; $d(\nu)$&nbsp; zur Beschreibung des Zeitverlaufs seien entsprechend der&nbsp; '''Zeile 2'''&nbsp; der folgenden Tabelle „dreieckförmig” belegt. Beachten Sie hierbei die periodische Fortsetzung der DFT, so dass der lineare Anstieg für&nbsp; $t \lt 0$&nbsp; durch die Koeffizienten&nbsp; $d(8), \hspace{0.05cm}\text{ ...} \hspace{0.05cm}, d(15)$&nbsp; ausgedrückt wird.
+
Let the DFT coefficients&nbsp; $d(\nu)$&nbsp; for the description of the time course be "triangular" according to&nbsp; '''line 2'''&nbsp; of the following table. Note here the periodic continuation of the DFT, so that the linear increase for&nbsp; $t \lt 0$&nbsp; is given by the coefficients&nbsp; $d(8), \hspace{0.05cm}\text{ ...} \hspace{0.05cm}, d(15)$&nbsp; is expressed.
  
Durch Anwendung des DFT–Algorithmus mit&nbsp; $N = 16$&nbsp; erhält man die in der&nbsp; '''Zeile 3'''&nbsp; angegebenen Spektralkoeffizienten&nbsp; $D(\mu )$, die bei Vernachlässigung des Aliasingfehlers gleich&nbsp; $D(\mu ) = 4 \cdot \text{si}^2(\pi \cdot \mu/2)$&nbsp; wären. Man erkennt, dass sich der Aliasingfehler nur auf die ungeradzahligen Koeffizienten auswirkt (schraffierte Felder). Beispielsweise müsste&nbsp; $D(1) = 16/ \pi^2 \approx 1.621\neq 1.642$&nbsp; sein.
+
Applying the DFT algorithm with&nbsp; $N = 16$&nbsp; one obtains the spectral coefficients&nbsp; $D(\mu )$ given in&nbsp; '''line 3'''&nbsp; which would be equal&nbsp; $D(\mu ) = 4 \cdot \text{si}^2(\pi \cdot \mu/2)$&nbsp; if the aliasing error were neglected. We can see that the aliasing error only affects the odd coefficients (shaded boxes). For example, $D(1) = 16/ \pi^2 \approx 1.621\neq 1.642$&nbsp; should be.
  
[[File:Sig_T_5_5_S2b_Version2.png|center|frame|Ergebnistabelle zum &nbsp;$\text{Beispiel 1}$&nbsp; zum Überlagerungssatz der DFT]]
+
[[File:Sig_T_5_5_S2b_Version2.png|center|frame|Result Table for &nbsp;$\text{Example 1}$&nbsp; for the Superposition Theorem of the DFT]]
  
Spaltet man die Gesamtfolge&nbsp; $\langle \hspace{0.1cm}d(\nu)\hspace{0.1cm}\rangle$&nbsp; in zwei Teilfolgen&nbsp; $\langle \hspace{0.1cm}{d_1}'(\nu)\hspace{0.1cm}\rangle$&nbsp; und&nbsp; $\langle \hspace{0.1cm} {d_2}'(\nu)\hspace{0.1cm}\rangle$&nbsp; auf, und zwar derart, dass die erste (gelb hinterlegte) Teilfolge nur geradzahlige Koeffizienten&nbsp; $(\nu = 0, 2, \hspace{0.03cm}\text{ ...} \hspace{0.1cm}, N–2)$&nbsp; und die zweite (grün hinterlegt) nur ungeradzahlige Koeffizienten&nbsp; $(\nu = 1, 3, \hspace{0.03cm}\text{ ...} \hspace{0.1cm} , N–1)$&nbsp; beinhalten und alle anderen zu Null gesetzt sind, so erhält man die zugehörigen Folgen im Spektralbereich:
+
If we split the total sequence&nbsp; $\langle \hspace{0.1cm}d(\nu)\hspace{0.1cm}\rangle$&nbsp; into two subsequences&nbsp; $\langle \hspace{0.1cm}{d_1}'(\nu)\hspace{0.1cm}\rangle$&nbsp; and &nbsp; $\langle \hspace{0.1cm}{d_2}'(\nu)\hspace{0.1cm}\rangle$&nbsp; such that the first subsequence (highlighted in yellow) has only even coefficients&nbsp; $(\nu = 0, 2, \hspace{0.03cm}\text{ ...} \hspace{0.1cm}, N–2)$&nbsp; and the second (green background) contains only odd coefficients&nbsp; $(\nu = 1, 3, \hspace{0.03cm}\text{ ...} \hspace{0.1cm} , N-1)$&nbsp; and all others are set to zero, the corresponding sequences in the spectral domain are obtained:
 
   
 
   
 
:$$ \langle \hspace{0.1cm}{D_1}'(\mu)\hspace{0.1cm} \rangle  \hspace{0.2cm}\bullet\!\!-\!\!\!-(N)\!-\!\!\!-\!\!\hspace{0.05cm}\circ\, \hspace{0.2cm} \langle \hspace{0.1cm} {d_1}'(\nu) \hspace{0.1cm}\rangle , $$
 
:$$ \langle \hspace{0.1cm}{D_1}'(\mu)\hspace{0.1cm} \rangle  \hspace{0.2cm}\bullet\!\!-\!\!\!-(N)\!-\!\!\!-\!\!\hspace{0.05cm}\circ\, \hspace{0.2cm} \langle \hspace{0.1cm} {d_1}'(\nu) \hspace{0.1cm}\rangle , $$
 
:$$ \langle \hspace{0.1cm}{D_2}'(\mu) \hspace{0.1cm}\rangle \hspace{0.2cm}\bullet\!\!-\!\!\!-(N)\!-\!\!\!-\!\!\hspace{0.05cm}\circ\, \hspace{0.2cm} \langle\hspace{0.1cm} {d_2}'(\nu) \rangle \hspace{0.1cm}\hspace{0.05cm}.$$
 
:$$ \langle \hspace{0.1cm}{D_2}'(\mu) \hspace{0.1cm}\rangle \hspace{0.2cm}\bullet\!\!-\!\!\!-(N)\!-\!\!\!-\!\!\hspace{0.05cm}\circ\, \hspace{0.2cm} \langle\hspace{0.1cm} {d_2}'(\nu) \rangle \hspace{0.1cm}\hspace{0.05cm}.$$
  
In den gelb bzw. grün hinterlegten Zeilen&nbsp; $4\hspace{0.05cm}\text{ ...} \hspace{0.05cm}7$&nbsp; erkennt man:
+
In the yellow or green lines&nbsp; $4\hspace{0.05cm}\text{ ...} \hspace{0.05cm}7$&nbsp; you can see:
*Wegen&nbsp; $d(\nu) = {d_1}'(\nu) + {d_2}'(\nu)$&nbsp; gilt auch&nbsp; $D(\mu ) = {D_1}'(\mu ) + {D_2}'(\mu )$. Dies lässt sich zum Beispiel mit dem&nbsp; [[Signal_Representation/Fourier_Transform_Laws#Multiplikation_mit_Faktor_-_Additionssatz|Additionstheorem linearer Systeme]]&nbsp; begründen.
+
*because&nbsp; $d(\nu) = {d_1}'(\nu) + {d_2}'(\nu)$&nbsp; also holds&nbsp; $D(\mu ) = {D_1}'(\mu ) + {D_2}'(\mu )$. This can be justified, for example, with the&nbsp; [[Signal_Representation/Fourier_Transform_Laws#Multiplication_with_Factor_-_Addition Theorem|Addition Theorem of Linear Systems]]&nbsp;.
*Die Periode der Folge&nbsp; $\langle \hspace{0.1cm}{D_1}'(\mu )\hspace{0.1cm}\rangle$&nbsp; ist aufgrund des Nullsetzens eines jeden zweiten Zeitkoeffizienten nun&nbsp; $N/2$&nbsp; im Gegensatz zur Periode&nbsp; $N$&nbsp; der Folge&nbsp; $\langle \hspace{0.1cm} D(\mu )\hspace{0.1cm}\rangle$:
+
*The period of the sequence&nbsp; $\langle \hspace{0.1cm}{D_1}'(\mu )\hspace{0.1cm}\rangle$&nbsp; due to the zeroing of every second time coefficient is now&nbsp; $N/2$&nbsp; unlike the period&nbsp; $N$&nbsp; of the sequence&nbsp; $\langle \hspace{0.1cm} D(\mu )\hspace{0.1cm}\rangle$:
 
:$${D_1}'(\mu + {N}/{2}) ={D_1}'(\mu)\hspace{0.05cm}.$$  
 
:$${D_1}'(\mu + {N}/{2}) ={D_1}'(\mu)\hspace{0.05cm}.$$  
* $\langle \hspace{0.1cm} {D_2}'(\mu )\hspace{0.1cm}\rangle$&nbsp; beinhaltet zusätzlich einen Phasenfaktor (Verschiebung um einen Abtastwert), der einen Vorzeichenwechsel zweier um&nbsp; $N/2$&nbsp; auseinanderliegender Koeffizienten bewirkt:
+
* $\langle \hspace{0.1cm} {D_2}'(\mu )\hspace{0.1cm}\rangle$&nbsp; additionally contains a phase factor (shift by one sample) which causes a sign change of two coefficients separated by&nbsp; $N/2$&nbsp;:
 
:$${D_2}'(\mu + {N}/{2}) = - {D_2}'(\mu)\hspace{0.05cm}.$$  
 
:$${D_2}'(\mu + {N}/{2}) = - {D_2}'(\mu)\hspace{0.05cm}.$$  
*Die Berechnung von&nbsp; $\langle \hspace{0.1cm}{D_1}'(\mu )\hspace{0.1cm}\rangle$&nbsp; und&nbsp; $\langle \hspace{0.1cm} {D_2}'(\mu )\hspace{0.1cm}\rangle$&nbsp; ist aber jeweils ebenso aufwändig wie die Bestimmung von&nbsp; $\langle \hspace{0.1cm}D(\mu )\hspace{0.1cm}\rangle$, da&nbsp; $\langle \hspace{0.1cm}{d_1}'(\nu)\hspace{0.1cm}\rangle$&nbsp; und&nbsp; $\langle \hspace{0.1cm}{d_2}'(\nu)\hspace{0.1cm}\rangle$&nbsp; ebenfalls aus&nbsp; $N$&nbsp; Elementen bestehen, auch wenn einige Null sind.}}  
+
*The calculation of&nbsp; $\langle \hspace{0.1cm}{D_1}'(\mu )\hspace{0.1cm}\rangle$&nbsp; and&nbsp; $\langle \hspace{0.1cm} {D_2}'(\mu )\hspace{0.1cm}\rangle$&nbsp; is, however, in each case as laborious as the determination of&nbsp; $\langle \hspace{0.1cm}D(\mu )\hspace{0.1cm}\rangle$, since&nbsp; $\langle \hspace{0.1cm}{d_1}'(\nu)\hspace{0.1cm}\rangle$&nbsp; and&nbsp; $\langle \hspace{0.1cm}{d_2}'(\nu)\hspace{0.1cm}\rangle$&nbsp; also consist of&nbsp; $N$&nbsp; elements, even if some are zero.}}  
  
  
 
{{GraueBox|TEXT=   
 
{{GraueBox|TEXT=   
$\text{Beispiel 2:}$&nbsp;
+
$\text{Example 2:}$&nbsp;
Zur Fortsetzung des ersten Beispiels wird nun die bisherige Tabelle um die Zeilen &nbsp;$8$&nbsp; bis &nbsp;$12$&nbsp; erweitert.
+
To continue the first example, the previous table is now extended by the rows &nbsp;$8$&nbsp; to &nbsp;$12$&nbsp;.
 
                        
 
                        
[[File:Sig_T_5_5_S2c_Version2.png|center|frame|Ergebnistabelle zum &nbsp;$\text{Beispiel 2}$&nbsp; zum Überlagerungssatz der DFT]]
+
[[File:Sig_T_5_5_S2c_Version2.png|center|frame|Result Table for &nbsp;$\text{Example 2}$&nbsp; For The Superposition Theorem of The DFT]]
  
Verzichtet man auf die Koeffizienten&nbsp; ${d_1}'(\nu) = 0$&nbsp; mit ungeraden sowie auf&nbsp; ${d_2}'(\nu) = 0$&nbsp; mit geraden Indizes, so kommt man zu den Teilfolgen&nbsp; $\langle \hspace{0.1cm}d_1(\nu)\hspace{0.1cm}\rangle$&nbsp; und&nbsp; $\langle \hspace{0.1cm}d_2(\nu)\hspace{0.1cm}\rangle$&nbsp; entsprechend den  Zeilen &nbsp;$9$&nbsp; und &nbsp;$11$&nbsp;. Man erkennt:
+
Omitting the coefficients&nbsp; ${d_1}'(\nu) = 0$&nbsp; with odd indices and&nbsp; ${d_2}'(\nu) = 0$&nbsp; with even indices, we arrive at the subsequences&nbsp; $\langle \hspace{0.1cm}d_1(\nu)\hspace{0.1cm}\rangle$&nbsp; and&nbsp; $\langle \hspace{0.1cm}d_2(\nu)\hspace{0.1cm}\rangle$&nbsp; corresponding to lines &nbsp;$9$&nbsp; and &nbsp;$11$&nbsp;. You can see:
*Die Zeitfolgen&nbsp; $\langle \hspace{0.1cm}{d_1}(\nu )\hspace{0.1cm}\rangle$&nbsp; und&nbsp; $\langle \hspace{0.1cm}{d_2}(\nu )\hspace{0.1cm}\rangle$&nbsp; weisen ebenso wie die dazugehörigen Spektralfolgen&nbsp; $\langle \hspace{0.1cm}{D_1}(\mu )\hspace{0.1cm}\rangle$&nbsp; und&nbsp; $\langle \hspace{0.1cm}{D_2}(\mu )\hspace{0.1cm}\rangle$&nbsp; nur noch die Dimension $N/2$ auf.
+
*The time sequences&nbsp; $\langle \hspace{0.1cm}{d_1}(\nu )\hspace{0.1cm}\rangle$&nbsp; and&nbsp; $\langle \hspace{0.1cm}{d_2}(\nu )\hspace{0.1cm}\rangle$&nbsp; exhibit as well as the corresponding spectral sequences&nbsp; $\langle \hspace{0.1cm}{D_1}(\mu )\hspace{0.1cm}\rangle$&nbsp; and&nbsp; $\langle \hspace{0.1cm}{D_2}(\mu )\hspace{0.1cm}\rangle$&nbsp; only have the dimension $N/2$.
*Ein Vergleich der Zeilen&nbsp; $5$,&nbsp; $7$,&nbsp; $10$&nbsp; und&nbsp; $12$&nbsp; zeigt für&nbsp; $0 \le \mu \lt N/2$&nbsp; folgenden Zusammenhang:
+
*A comparison of the lines&nbsp; $5$,&nbsp; $7$,&nbsp; $10$&nbsp; and&nbsp; $12$&nbsp; shows the following relationship for&nbsp; $0 \le \mu \lt N/2$&nbsp;:
 
:$${D_1}'(\mu) = {1}/{2}\cdot {D_1}(\mu)\hspace{0.05cm},$$
 
:$${D_1}'(\mu) = {1}/{2}\cdot {D_1}(\mu)\hspace{0.05cm},$$
 
:$$ {D_2}'(\mu) = {1}/{2}\cdot {D_2}(\mu)\cdot w^{\hspace{0.04cm}\mu}\hspace{0.05cm}.$$  
 
:$$ {D_2}'(\mu) = {1}/{2}\cdot {D_2}(\mu)\cdot w^{\hspace{0.04cm}\mu}\hspace{0.05cm}.$$  
*Entsprechend ergibt sich für&nbsp; $N/2 \le \mu \lt N$:
+
*Correspondingly, for&nbsp; $N/2 \le \mu \lt N$:
 
:$${D_1}'(\mu)  =  {1}/{2}\cdot {D_1}(\mu - {N}/{2})\hspace{0.05cm},$$
 
:$${D_1}'(\mu)  =  {1}/{2}\cdot {D_1}(\mu - {N}/{2})\hspace{0.05cm},$$
 
:$$ {D_2}'(\mu) =  {1}/{2}\cdot {D_2}(\mu {-} {N}/{2})\cdot w^{\hspace{0.04cm}\mu}
 
:$$ {D_2}'(\mu) =  {1}/{2}\cdot {D_2}(\mu {-} {N}/{2})\cdot w^{\hspace{0.04cm}\mu}
Line 104: Line 104:
 
$$
 
$$
  
*Zum Beispiel erhält man mit&nbsp; $N = 16$ &nbsp; ⇒ &nbsp; $w = {\rm e}^{ {\rm j}\hspace{0.04cm} \cdot \hspace{0.04cm}\pi/8}$&nbsp; für die Indizes&nbsp; $\mu = 1$&nbsp; bzw.&nbsp; $\mu = 9$:&nbsp;
+
*For example, with&nbsp; $N = 16$ &nbsp; ⇒ &nbsp; $w = {\rm e}^{ - {\rm j}\hspace{0.04cm} \cdot \hspace{0.04cm}\pi/8}$&nbsp; for the indices&nbsp; $\mu = 1$&nbsp; respectively&nbsp; $\mu = 9$:&nbsp;
 
:$${D_1}'(1)  =  {1.708}/{2} = 0.854,\hspace{0.8cm}
 
:$${D_1}'(1)  =  {1.708}/{2} = 0.854,\hspace{0.8cm}
 
  {D_2}'(1) ={1}/{2}\cdot (1.456 + {\rm j} 0.603) \cdot {\rm e}^{ - {\rm j} \hspace{0.05cm}\cdot \hspace{0.05cm}
 
  {D_2}'(1) ={1}/{2}\cdot (1.456 + {\rm j} 0.603) \cdot {\rm e}^{ - {\rm j} \hspace{0.05cm}\cdot \hspace{0.05cm}
Line 116: Line 116:
  
 
{{BlaueBox|TEXT=
 
{{BlaueBox|TEXT=
$\text{Fazit:}$&nbsp;   
+
$\text{Conclusion:}$&nbsp;   
*Durch diese erste Anwendung des Überlagerungssatzes halbiert sich nahezu der Rechenaufwand.  
+
*This first application of the superposition theorem almost halves the computational effort.  
*Statt&nbsp; $\mathcal{O}= 1920$&nbsp; benötigt man nur noch &nbsp;$\mathcal{O} = 2 · 448 + 8 \cdot (4+2) + 16 \cdot 2 = 976$&nbsp; reelle Operationen.  
+
*Instead of&nbsp; $\mathcal{O}= 1920$&nbsp; one only needs &nbsp;$\mathcal{O} = 2 - 448 + 8 \cdot (4+2) + 16 \cdot 2 = 976$&nbsp; real operations.  
*Der erste Summand berücksichtigt die beiden DFT–Berechnungen mit&nbsp; $N/2 = 8$.  
+
*The first summand accounts for the two DFT calculations with&nbsp; $N/2 = 8$.  
*Der Rest wird für die acht komplexen Multiplikationen und die&nbsp; $16$&nbsp; komplexen Additionen bzw. Subtraktionen benötigt.}}
+
*The remainder is needed for the eight complex multiplications and the&nbsp; $16$&nbsp; complex additions and subtractions, respectively.}}
  
==Radix-2-Algorithmus nach Cooley und Tukey==   
+
==Radix-2-Algorithm According to Cooley and Tukey==   
 
<br>  
 
<br>  
Ebenso wie andere FFT–Algorithmen baut das hier vorgestellte Verfahren&nbsp; [CT65]<ref name ='CT65'>Cooley, J.W.; Tukey, J.W.: ''An Algorithm for the Machine Calculation of Complex Fourier Series''. In: Mathematics of Computation, Vol. 19, No. 90. (Apr., 1965), pp. 297-301.</ref>&nbsp; von&nbsp; [https://de.wikipedia.org/wiki/James_Cooley James W. Cooley]&nbsp; und&nbsp; [https://en.wikipedia.org/wiki/John_Tukey John W. Tukey]&nbsp; auf dem Überlagerungssatz der DFT auf. Es funktioniert nur dann, wenn die Stützstellenzahl&nbsp; $N$&nbsp; eine Zweierpotenz ist.  
+
Like other FFT algorithms, the method presented herenbsp; [CT65]<ref name ='CT65'>Cooley, J.W.; Tukey, J.W.: ''An Algorithm for the Machine Calculation of Complex Fourier Series''. In: Mathematics of Computation, Vol. 19, No. 90. (Apr., 1965), pp. 297-301.</ref>&nbsp; from &nbsp; [https://en.wikipedia.org/wiki/James_Cooley James W. Cooley]&nbsp; and&nbsp; [https://en.wikipedia.org/wiki/John_Tukey John W. Tukey]&nbsp; on the superposition theorem of the DFT. It only works if the number of interpolation points is a power of two.  
  
Die Grafik verdeutlicht den Algorithmus für&nbsp; $N = 8$, wobei wieder die Transformation vom Zeit– in den Frequenzbereich dargestellt ist.
+
The diagram illustrates the algorithm for&nbsp; $N = 8$, again showing the transformation from the time to the frequency domain.
[[File:P_ID1173__Sig_T_5_5_S3a_neu.png|right|frame|frame|Radix-2-Algorithmus (Flussdiagramm)]]
+
[[File:P_ID1173__Sig_T_5_5_S3a_neu.png|right|frame|frame|Radix-2-Algorithm (Flow Diagram)]]
  
*Vor dem eigentlichen FFT-Algorithmus müssen zunächst die Eingangswerte&nbsp; $d(0), \hspace{0.05cm}\text{...} \hspace{0.1cm}, d( N - 1)$&nbsp; im grauen Block &bdquo;Bitumkehroperation&rdquo; umsortiert werden.  
+
*Before the actual FFT algorithm, the input values&nbsp; $d(0), \hspace{0.05cm}\text{...} \hspace{0.1cm}, d( N - 1)$&nbsp; be reordered in the grey block &bdquo;Bit Reverse Operation&rdquo;.  
*Die Berechnung erfolgt in&nbsp; $\text{log}_2 N = 3$&nbsp; Stufen, wobei in jeder Stufe&nbsp; $N/2 = 4$&nbsp; gleiche Berechnungen mit verschiedenen&nbsp; $\mu$&ndash;Werten <br>(= Exponent des komplexen Drehfaktors) ausgeführt werden. Eine solche Basisoperation bezeichnet man auch als&nbsp; '''Butterfly'''.
+
*The computation is done in&nbsp; $\text{log}_2 N = 3$&nbsp; stages, where in each stage&nbsp; $N/2 = 4$&nbsp; equal computations are performed with different&nbsp; $\mu$&ndash;values <br>(= exponent of the complex rotation factor). Such a basic operation is also called a&nbsp; '''butterfly'''.
*Jeder Butterfly berechnet aus zwei (im Allgemeinen komplexen) Eingangsgrößen&nbsp; $A$&nbsp; und&nbsp; $B$&nbsp; die beiden Ausgangsgrößen&nbsp; $A + B \cdot w^{\mu}$&nbsp; sowie&nbsp; $A B \cdot w^{\mu}$&nbsp; entsprechend der folgenden Skizze.
+
*Each butterfly calculates from two (generally complex) input variables&nbsp; $A$&nbsp; and&nbsp; $B$&nbsp; the two output variables&nbsp; $A + B \cdot w^{\mu}$&nbsp; and&nbsp; $A - B \cdot w^{\mu}$&nbsp; according to the following sketch.
  
  
[[File:P_ID1174__Sig_T_5_5_S3b_neu.png|center|frame|Butterfly des DFT-Algorithmus]]
+
[[File:P_ID1174__Sig_T_5_5_S3b_neu.png|center|frame|Butterfly of The DFT-Algorithm]]
  
 
{{BlaueBox|TEXT=
 
{{BlaueBox|TEXT=
$\text{Fazit:}$&nbsp;   
+
$\text{Conclusion:}$&nbsp;   
Die komplexen Spektralkoeffizienten&nbsp; $D(0), \hspace{0.05cm}\text{...} \hspace{0.1cm}, D( N - 1)$&nbsp; erhält man am Ausgang der letzten Stufe nach Division durch&nbsp; $N$.  
+
The complex spectral coefficients&nbsp; $D(0), \hspace{0.05cm}\text{...} \hspace{0.1cm}, D( N - 1)$&nbsp; are obtained at the output of the last stage after division by&nbsp; $N$.  
*Wie in der&nbsp; [[Aufgaben:Aufgabe_5.5Z:_Rechenaufwand_für_die_FFT|Aufgabe 5.5Z]]&nbsp; gezeigt wird, ergibt sich gegenüber der DFT eine deutlich kürzere Rechenzeit, zum Beispiel für&nbsp; $N = 1024$&nbsp; um mehr als den Faktor&nbsp; $150$.
+
*As shown in the&nbsp; [[Aufgaben:Aufgabe_5.5Z:_Rechenaufwand_für_die_FFT|exercise 5.5Z]]&nbsp; compared to the DFT, this results in a much shorter computation time, for example for&nbsp; $N = 1024$&nbsp; by more than a factor&nbsp; $150$.
  
*Die inverse DFT zur Berechnung der Zeit&ndash; aus den Spektralkoeffizienten geschieht mit dem gleichen Algorithmus und nur geringfügigen Modifizierungen.}}
+
*The inverse DFT for calculating the time&ndash; from the spectral coefficients is done with the same algorithm and only slight modifications.}}
  
  
[[File:EN_Sig_Programm.png|right|frame|Radix-2-Algorithmus (C-Programm)]]
+
[[File:EN_Sig_Programm.png|right|frame|Radix-2-Algorithm (C-Program)]]
 
{{GraueBox|TEXT=
 
{{GraueBox|TEXT=
$\text{Beispiel 3:}$&nbsp;   
+
$\text{Example 3:}$&nbsp;   
Abschließend wird ein C–Programm <br>
+
Finally, a C program <br>
 
:$$\text{fft(N, Re, Im)}$$  
 
:$$\text{fft(N, Re, Im)}$$  
gemäß dem oben beschriebenen Radix–2–Algorithmus angegeben:
+
according to the Radix-2 algorithm described above is given:
  
*Beim Aufruf beinhalten die beiden Float–Arrays „Re” und „Im” die&nbsp; $N$&nbsp; Real– und Imaginärteile der komplexen Zeitkoeffizienten&nbsp; $d(0)$, ... , $d( N - 1)$.
+
*When called, the two float arrays "Re" and "Im" contain the&nbsp; $N$&nbsp; real and imaginary parts of the complex time coefficients&nbsp; $d(0)$, ... , $d( N - 1)$.
*In den gleichen Feldern „Re” und „Im” werden am Programmende die komplexen Koeffizienten&nbsp; $D(0)$, ... , $D( N - 1)$&nbsp; an das aufrufende Programm zurückgegeben.
+
*In the same fields "Re" and "Im" the complex coefficients&nbsp; $D(0)$, ... , $D( N - 1)$&nbsp; are returned to the calling program.
*Aufgrund der „In–Place”–Programmierung reichen somit für diesen Algorithmus&nbsp; $N$&nbsp; komplexe Speicherplätze aus, allerdings nur, wenn zu Beginn die Eingangswerte umsortiert werden.
+
*Due to the "in-place" programming, complex memory locations are thus sufficient for this algorithm&nbsp; $N$&nbsp; but only if the input values are reordered at the beginning.
*Dies geschieht durch das Programm „bitumkehr”, wobei die Inhalte von&nbsp; ${\rm Re}( \nu)$&nbsp; und&nbsp; ${\rm Im}( \nu)$&nbsp; in die Elemente&nbsp; ${\rm Re}( \kappa)$&nbsp; und&nbsp; ${\rm Im}( \kappa)$&nbsp; eingetragen werden. $\text{Beispiel 4}$&nbsp; verdeutlicht die Vorgehensweise.}}  
+
*This is done by the program "bit-reversal", where the contents of&nbsp; ${\rm Re}( \nu)$&nbsp; and&nbsp; ${\rm Im}( \nu)$&nbsp; are entered into the elements&nbsp; ${\rm Re}( \kappa)$&nbsp; and&nbsp; ${\rm Im}( \kappa)$&nbsp;. $\text{Example 4}$&nbsp; illustrates the procedure.}}  
  
  
[[File:P_ID1176__Sig_T_5_5_S3d_neu.png|right|frame|Radix-2-Algorithmus $($Bitumkehroperation für&nbsp; $N = 8)$]]
+
[[File:P_ID1176__Sig_T_5_5_S3d_neu.png|right|frame|Radix-2-Algorithm $($Bit reversing operation for&nbsp; $N = 8)$]]
 
{{GraueBox|TEXT=
 
{{GraueBox|TEXT=
$\text{Beispiel 4: Bitumkehroperation}$&nbsp;
+
$\text{Example 4: Bit reversing operation}$&nbsp;
  
*Der neue Index&nbsp; $\kappa$&nbsp; ergibt sich, wenn man den Index&nbsp; $\nu$&nbsp; als Dualzahl schreibt und anschließend die&nbsp; $\text{log}_2 \hspace{0.05cm} N$&nbsp; Bit in umgekehrter Reihenfolge darstellt.
+
*The new index&nbsp; $\kappa$&nbsp; is obtained by writing the index&nbsp; $\nu$&nbsp; as a dual number and then representing the&nbsp; $\text{log}_2 \hspace{0.05cm} N$&nbsp; bits in reverse order.
*Zum Beispiel wird aus&nbsp; $\nu = 3$&nbsp; der neue Index&nbsp; $\kappa = 6$.}}
+
*For example,&nbsp; $\nu = 3$&nbsp; becomes the new index&nbsp; $\kappa = 6$.}}
  
  
==Aufgaben zum Kapitel==   
+
==Exercises For the Chapter==   
 
<br>
 
<br>
 
[[Aufgaben:Exercise 5.5: Fast Fourier Transform|Exercise 5.5: Fast Fourier Transform]]
 
[[Aufgaben:Exercise 5.5: Fast Fourier Transform|Exercise 5.5: Fast Fourier Transform]]

Revision as of 04:29, 4 January 2021

Complexity of DFT and IDFT


A disadvantage of the direct calculation of the (generally complex) DFT number sequences

$$\langle \hspace{0.1cm}D(\mu)\hspace{0.1cm}\rangle \hspace{0.2cm}\bullet\!\!-\!\!\!-(N)\!-\!\!\!-\!\!\hspace{0.05cm}\circ\, \hspace{0.2cm} \langle \hspace{0.1cm}d(\nu)\hspace{0.1cm} \rangle$$

according to the equations given in chapter  Discrete Fourier Transform (DFT) is the large computational cost. We consider as an example the DFT, i.e. the calculation of the  $D(\mu)$  from the  $d(\nu)$:

$$N \cdot D(\mu) = \sum_{\nu = 0 }^{N-1} d(\nu) \cdot {w}^{\hspace{0.03cm}\nu \hspace{0.03cm} \cdot \hspace{0.05cm}\mu} = d(0) \cdot w^{\hspace{0.03cm}0} + d(1) \cdot w^{\hspace{0.03cm}\mu}+ d(2) \cdot w^{\hspace{0.03cm}2\mu}+\hspace{0.05cm}\text{ ...} \hspace{0.05cm}+ d(N-1) \cdot w^{\hspace{0.03cm}(N-1)\cdot \mu}$$

The computational effort required for this is to be estimated, assuming that the powers of the complex rotation factor  $w = {\rm e}^{-{\rm j} \hspace{0.05cm}\cdot \hspace{0.05cm}2 \pi/N}$  already exist in real and imaginary part form in a lookup table. To calculate a single coefficient, one then needs  $N-1$  complex multiplications and as many complex additions, observing:

  • Each complex addition requires two real additions:
$$(R_1 + {\rm j} \cdot I_1) + (R_2 + {\rm j} \cdot I_2) = (R_1 + R_2) + {\rm j} \cdot (I_1 + I_2)\hspace{0.05cm}.$$
  • Each complex multiplication requires four real multiplications and two real additions (a subtraction is treated as an addition):
$$(R_1 + {\rm j} \cdot I_1) (R_2 + {\rm j} \cdot I_2) = (R_1 \cdot R_2 - I_1 \cdot I_2) + {\rm j} \cdot (R_1 \cdot I_2 + R_2 \cdot I_1)\hspace{0.05cm}.$$
  • Thus, the following number of real multiplications and the number of real additions are required to calculate all $N$ coefficients in total:
$$M = 4 \cdot N \cdot (N-1),$$
$$A = 2 \cdot N \cdot (N-1)+2 \cdot N \cdot (N-1)=M \hspace{0.05cm}.$$
  • In today's computers, multiplications and additions/subtractions need about the same computing time. It is sufficient to consider the total number  $\mathcal{O} = M + A$  of all operations:
$$\mathcal{O} = 8 \cdot N \cdot (N-1) \approx 8 \cdot N^2\hspace{0.05cm}.$$

$\text{Conclusion:}$ 

  • For a  Discrete Fourier Transform  (DFT) with  $N = 1000$  one already needs almost eight million arithmetic operations. The same applies to an IDFT.
  • With  $N =16$  still  $1920$  computational operations are required

.


If the parameter  $N$  is a power to the base  $2$, more computationally efficient algorithms can be applied. The multitude of such methods known from the literature are summarised under the collective term  Fast Fourier Transform  - abbreviated  FFT  -. All these methods are based on the superposition theorem of the DFT.

Superposition Theorem of the DFT


The graph illustrates the so-called superposition theorem of the DFT using the example of $N = 16$. Shown here is the transition from the time domain to the spectral domain, i.e. the calculation of the spectral domain coefficients from the time domain coefficients:   $\langle \hspace{0.1cm}D(\mu)\hspace{0.1cm}\rangle \hspace{0.2cm}\bullet\!\!-\!\!\!-(N)\!-\!\!\!-\!\!\hspace{0.05cm}\circ\, \hspace{0.2cm} \langle \hspace{0.1cm} d(\nu) \hspace{0.1cm}\rangle.$

Superposition Theorem of the DFT

The algorithm described thereby is characterised by the following steps:

  • The sequence  $\langle \hspace{0.1cm}d(\nu)\hspace{0.1cm}\rangle$  of length  $N$  is divided into two subsequences$\langle \hspace{0.1cm} d_1(\nu)\hspace{0.1cm}\rangle$  and  $\langle \hspace{0.1cm} d_2(\nu)\hspace{0.1cm}\rangle$  each of half length (highlighted in yellow and green respectively in the garafic). With  $0 \le \nu \lt N/2$  one thus obtains the sequence elements
$$d_1(\nu) = d(2\nu), $$
$$d_2(\nu) = d(2\nu+1) \hspace{0.05cm}.$$
  • The initial sequences  $\langle \hspace{0.1cm}D_1(\mu )\hspace{0.1cm}\rangle$  and  $\langle \hspace{0.1cm}D_2(\mu )\hspace{0.1cm}\rangle$  of the two sub-blocks result from this each by its own DFT, but now only with half length  $N/2 = 8$:
$$\langle \hspace{0.1cm}D_1(\mu) \hspace{0.1cm}\rangle \hspace{0.2cm}\bullet\!\!-\!\!\!-(N/2)\!-\!\!\!-\!\!\hspace{0.05cm}\circ\, \hspace{0.2cm} \langle \hspace{0.1cm}d_1(\nu) \hspace{0.1cm}\rangle , $$
$$ \langle \hspace{0.1cm}D_2(\mu)\hspace{0.1cm} \rangle \hspace{0.2cm}\bullet\!\!-\!\!\!-(N/2)\!-\!\!\!-\!\!\hspace{0.05cm}\circ\, \hspace{0.2cm} \langle \hspace{0.1cm}d_2(\nu) \hspace{0.1cm}\rangle \hspace{0.05cm}.$$
  • The initial values  $\langle \hspace{0.1cm} D_2(\mu )\hspace{0.1cm}\rangle$  of the lower (green) DFT $($with  $0 \le \mu \lt N/2)$  are then changed in the block outlined in red by complex rotation factors with respect to phase:
$$D_2(\mu) \hspace{0.3cm} \Rightarrow \hspace{0.3cm}D_2(\mu) \cdot w^{\hspace{0.04cm}\mu}, \hspace{0.2cm}{\rm wobei}\hspace{0.1cm}w = {\rm e}^{-{\rm j} \hspace{0.05cm}\cdot \hspace{0.05cm}2 \pi/N} \hspace{0.05cm}.$$
  • Each single  Butterfly  in the blue bordered block (in the middle of the graph) yields two elements of the searched sequence by addition or subtraction. With  $0 \le \mu \lt N/2$  applies:
$$D(\mu) = {1}/{2}\cdot \big[D_1(\mu) + D_2(\mu) \cdot w^{\hspace{0.04cm}\mu}\big],$$
$$D(\mu +{N}/{2}) = {1}/{2}\cdot \big[D_1(\mu) - D_2(\mu) \cdot w^{\hspace{0.04cm}\mu}\big]\hspace{0.05cm}.$$

This first application of the superposition theorem thus roughly halves the computational effort.

$\text{Example 1:}$  Let the DFT coefficients  $d(\nu)$  for the description of the time course be "triangular" according to  line 2  of the following table. Note here the periodic continuation of the DFT, so that the linear increase for  $t \lt 0$  is given by the coefficients  $d(8), \hspace{0.05cm}\text{ ...} \hspace{0.05cm}, d(15)$  is expressed.

Applying the DFT algorithm with  $N = 16$  one obtains the spectral coefficients  $D(\mu )$ given in  line 3  which would be equal  $D(\mu ) = 4 \cdot \text{si}^2(\pi \cdot \mu/2)$  if the aliasing error were neglected. We can see that the aliasing error only affects the odd coefficients (shaded boxes). For example, $D(1) = 16/ \pi^2 \approx 1.621\neq 1.642$  should be.

Result Table for  $\text{Example 1}$  for the Superposition Theorem of the DFT

If we split the total sequence  $\langle \hspace{0.1cm}d(\nu)\hspace{0.1cm}\rangle$  into two subsequences  $\langle \hspace{0.1cm}{d_1}'(\nu)\hspace{0.1cm}\rangle$  and   $\langle \hspace{0.1cm}{d_2}'(\nu)\hspace{0.1cm}\rangle$  such that the first subsequence (highlighted in yellow) has only even coefficients  $(\nu = 0, 2, \hspace{0.03cm}\text{ ...} \hspace{0.1cm}, N–2)$  and the second (green background) contains only odd coefficients  $(\nu = 1, 3, \hspace{0.03cm}\text{ ...} \hspace{0.1cm} , N-1)$  and all others are set to zero, the corresponding sequences in the spectral domain are obtained:

$$ \langle \hspace{0.1cm}{D_1}'(\mu)\hspace{0.1cm} \rangle \hspace{0.2cm}\bullet\!\!-\!\!\!-(N)\!-\!\!\!-\!\!\hspace{0.05cm}\circ\, \hspace{0.2cm} \langle \hspace{0.1cm} {d_1}'(\nu) \hspace{0.1cm}\rangle , $$
$$ \langle \hspace{0.1cm}{D_2}'(\mu) \hspace{0.1cm}\rangle \hspace{0.2cm}\bullet\!\!-\!\!\!-(N)\!-\!\!\!-\!\!\hspace{0.05cm}\circ\, \hspace{0.2cm} \langle\hspace{0.1cm} {d_2}'(\nu) \rangle \hspace{0.1cm}\hspace{0.05cm}.$$

In the yellow or green lines  $4\hspace{0.05cm}\text{ ...} \hspace{0.05cm}7$  you can see:

  • because  $d(\nu) = {d_1}'(\nu) + {d_2}'(\nu)$  also holds  $D(\mu ) = {D_1}'(\mu ) + {D_2}'(\mu )$. This can be justified, for example, with the  Addition Theorem of Linear Systems .
  • The period of the sequence  $\langle \hspace{0.1cm}{D_1}'(\mu )\hspace{0.1cm}\rangle$  due to the zeroing of every second time coefficient is now  $N/2$  unlike the period  $N$  of the sequence  $\langle \hspace{0.1cm} D(\mu )\hspace{0.1cm}\rangle$:
$${D_1}'(\mu + {N}/{2}) ={D_1}'(\mu)\hspace{0.05cm}.$$
  • $\langle \hspace{0.1cm} {D_2}'(\mu )\hspace{0.1cm}\rangle$  additionally contains a phase factor (shift by one sample) which causes a sign change of two coefficients separated by  $N/2$ :
$${D_2}'(\mu + {N}/{2}) = - {D_2}'(\mu)\hspace{0.05cm}.$$
  • The calculation of  $\langle \hspace{0.1cm}{D_1}'(\mu )\hspace{0.1cm}\rangle$  and  $\langle \hspace{0.1cm} {D_2}'(\mu )\hspace{0.1cm}\rangle$  is, however, in each case as laborious as the determination of  $\langle \hspace{0.1cm}D(\mu )\hspace{0.1cm}\rangle$, since  $\langle \hspace{0.1cm}{d_1}'(\nu)\hspace{0.1cm}\rangle$  and  $\langle \hspace{0.1cm}{d_2}'(\nu)\hspace{0.1cm}\rangle$  also consist of  $N$  elements, even if some are zero.


$\text{Example 2:}$  To continue the first example, the previous table is now extended by the rows  $8$  to  $12$ .

Result Table for  $\text{Example 2}$  For The Superposition Theorem of The DFT

Omitting the coefficients  ${d_1}'(\nu) = 0$  with odd indices and  ${d_2}'(\nu) = 0$  with even indices, we arrive at the subsequences  $\langle \hspace{0.1cm}d_1(\nu)\hspace{0.1cm}\rangle$  and  $\langle \hspace{0.1cm}d_2(\nu)\hspace{0.1cm}\rangle$  corresponding to lines  $9$  and  $11$ . You can see:

  • The time sequences  $\langle \hspace{0.1cm}{d_1}(\nu )\hspace{0.1cm}\rangle$  and  $\langle \hspace{0.1cm}{d_2}(\nu )\hspace{0.1cm}\rangle$  exhibit as well as the corresponding spectral sequences  $\langle \hspace{0.1cm}{D_1}(\mu )\hspace{0.1cm}\rangle$  and  $\langle \hspace{0.1cm}{D_2}(\mu )\hspace{0.1cm}\rangle$  only have the dimension $N/2$.
  • A comparison of the lines  $5$,  $7$,  $10$  and  $12$  shows the following relationship for  $0 \le \mu \lt N/2$ :
$${D_1}'(\mu) = {1}/{2}\cdot {D_1}(\mu)\hspace{0.05cm},$$
$$ {D_2}'(\mu) = {1}/{2}\cdot {D_2}(\mu)\cdot w^{\hspace{0.04cm}\mu}\hspace{0.05cm}.$$
  • Correspondingly, for  $N/2 \le \mu \lt N$:
$${D_1}'(\mu) = {1}/{2}\cdot {D_1}(\mu - {N}/{2})\hspace{0.05cm},$$
$$ {D_2}'(\mu) = {1}/{2}\cdot {D_2}(\mu {-} {N}/{2})\cdot w^{\hspace{0.04cm}\mu} = { - } {1}/{2}\cdot {D_2}(\mu-N/2)\cdot w^{\hspace{0.04cm}\mu {-} N/2}\hspace{0.05cm}. $$
  • For example, with  $N = 16$   ⇒   $w = {\rm e}^{ - {\rm j}\hspace{0.04cm} \cdot \hspace{0.04cm}\pi/8}$  for the indices  $\mu = 1$  respectively  $\mu = 9$: 
$${D_1}'(1) = {1.708}/{2} = 0.854,\hspace{0.8cm} {D_2}'(1) ={1}/{2}\cdot (1.456 + {\rm j} 0.603) \cdot {\rm e}^{ - {\rm j} \hspace{0.05cm}\cdot \hspace{0.05cm} \pi/8} = 0.788$$
$$\Rightarrow D(1) = {D_1}'(1)+ {D_2}'(1)= 1.642 \hspace{0.05cm}.$$
$${D_9}'(1) = {1.708}/{2} = 0.854,\hspace{0.8cm} {D_2}'(9) = - {1}/{2}\cdot (1.456 + {\rm j} 0.603) \cdot {\rm e}^{ - {\rm j} \hspace{0.05cm}\cdot \hspace{0.05cm} \pi/8} = - 0.788$$
$$\Rightarrow D(9) = {D_1}'(9)+ {D_2}'(9)= 0.066 \hspace{0.05cm}.$$


$\text{Conclusion:}$ 

  • This first application of the superposition theorem almost halves the computational effort.
  • Instead of  $\mathcal{O}= 1920$  one only needs  $\mathcal{O} = 2 - 448 + 8 \cdot (4+2) + 16 \cdot 2 = 976$  real operations.
  • The first summand accounts for the two DFT calculations with  $N/2 = 8$.
  • The remainder is needed for the eight complex multiplications and the  $16$  complex additions and subtractions, respectively.

Radix-2-Algorithm According to Cooley and Tukey


Like other FFT algorithms, the method presented herenbsp; [CT65][1]  from   James W. Cooley  and  John W. Tukey  on the superposition theorem of the DFT. It only works if the number of interpolation points is a power of two.

The diagram illustrates the algorithm for  $N = 8$, again showing the transformation from the time to the frequency domain.

Radix-2-Algorithm (Flow Diagram)
  • Before the actual FFT algorithm, the input values  $d(0), \hspace{0.05cm}\text{...} \hspace{0.1cm}, d( N - 1)$  be reordered in the grey block „Bit Reverse Operation”.
  • The computation is done in  $\text{log}_2 N = 3$  stages, where in each stage  $N/2 = 4$  equal computations are performed with different  $\mu$–values
    (= exponent of the complex rotation factor). Such a basic operation is also called a  butterfly.
  • Each butterfly calculates from two (generally complex) input variables  $A$  and  $B$  the two output variables  $A + B \cdot w^{\mu}$  and  $A - B \cdot w^{\mu}$  according to the following sketch.


Butterfly of The DFT-Algorithm

$\text{Conclusion:}$  The complex spectral coefficients  $D(0), \hspace{0.05cm}\text{...} \hspace{0.1cm}, D( N - 1)$  are obtained at the output of the last stage after division by  $N$.

  • As shown in the  exercise 5.5Z  compared to the DFT, this results in a much shorter computation time, for example for  $N = 1024$  by more than a factor  $150$.
  • The inverse DFT for calculating the time– from the spectral coefficients is done with the same algorithm and only slight modifications.


Radix-2-Algorithm (C-Program)

$\text{Example 3:}$  Finally, a C program

$$\text{fft(N, Re, Im)}$$

according to the Radix-2 algorithm described above is given:

  • When called, the two float arrays "Re" and "Im" contain the  $N$  real and imaginary parts of the complex time coefficients  $d(0)$, ... , $d( N - 1)$.
  • In the same fields "Re" and "Im" the complex coefficients  $D(0)$, ... , $D( N - 1)$  are returned to the calling program.
  • Due to the "in-place" programming, complex memory locations are thus sufficient for this algorithm  $N$  but only if the input values are reordered at the beginning.
  • This is done by the program "bit-reversal", where the contents of  ${\rm Re}( \nu)$  and  ${\rm Im}( \nu)$  are entered into the elements  ${\rm Re}( \kappa)$  and  ${\rm Im}( \kappa)$ . $\text{Example 4}$  illustrates the procedure.


Radix-2-Algorithm $($Bit reversing operation for  $N = 8)$

$\text{Example 4: Bit reversing operation}$ 

  • The new index  $\kappa$  is obtained by writing the index  $\nu$  as a dual number and then representing the  $\text{log}_2 \hspace{0.05cm} N$  bits in reverse order.
  • For example,  $\nu = 3$  becomes the new index  $\kappa = 6$.


Exercises For the Chapter


Exercise 5.5: Fast Fourier Transform

Exercise 5.5Z: Complexity of The FFT

Quellenverzeichnis

  1. Cooley, J.W.; Tukey, J.W.: An Algorithm for the Machine Calculation of Complex Fourier Series. In: Mathematics of Computation, Vol. 19, No. 90. (Apr., 1965), pp. 297-301.