Difference between revisions of "Aufgaben:Exercise 5.5: Fast Fourier Transform"

From LNTwww
(Die Seite wurde neu angelegt: „ {{quiz-Header|Buchseite=*Buch*/*Kapitel* }} 250px|right|* ===Fragebogen=== <quiz display=simple> {Multiple-Choice Frage |type="[]"} - Falsch +…“)
 
 
(29 intermediate revisions by 6 users not shown)
Line 1: Line 1:
  
{{quiz-Header|Buchseite=*Buch*/*Kapitel*
+
{{quiz-Header|Buchseite=Signal_Representation/Fast_Fourier_Transform_(FFT)
 
}}
 
}}
  
[[File:*|250px|right|*]]
+
[[File:EN_Sig_A_5_5.png|right|frame|FFT algorithm for&nbsp; $N=8$]]
  
 +
The graph shows the signal flow diagram of the Fast Fourier Transform&nbsp; $\rm (FFT)$&nbsp; for&nbsp; $N = 8$.
  
===Fragebogen===
+
The associated spectral coefficients&nbsp; $D(0), \hspace{0.03cm}\text{...} \hspace{0.1cm} , D(7)$&nbsp; are determined from the time coefficients&nbsp; $d(0), \hspace{0.03cm}\text{...} \hspace{0.1cm}, d(7)$.&nbsp; The following applies to these with&nbsp; $0 ≤ μ ≤ 7$:
 +
 +
:$$D(\mu) = \frac{1}{N}\cdot \sum_{\nu = 0 }^{N-1}
 +
d(\nu) \cdot  {w}^{\hspace{0.03cm}\nu \hspace{0.05cm} \cdot
 +
\hspace{0.05cm}\mu}\hspace{0.05cm},$$
 +
 
 +
where the complex rotation factor&nbsp; $w = \text{e}^{-\text{j}\hspace{0.05cm} \cdot
 +
\hspace{0.05cm}2\pi /N}$&nbsp; is to be used, i.e.&nbsp; $w = \text{e}^{-\text{j}\hspace{0.05cm} \cdot
 +
\hspace{0.05cm}\pi /4}$&nbsp; für&nbsp; $N = 8$.
 +
 
 +
*The alternating $±1$ sequence&nbsp; $\langle\hspace{0.05cm} d(ν)\hspace{0.05cm}\rangle$&nbsp; is applied to the input.
 +
*After the bit reversal operation, this results in the sequence&nbsp; $\langle \hspace{0.05cm}b(\kappa)\hspace{0.05cm}\rangle$.
 +
 
 +
 
 +
It holds that&nbsp; $b(κ) = d(ν)$, if&nbsp; $ν$&nbsp; is represented as a dual number and the resulting three bits are written as&nbsp; $κ$&nbsp; in reverse order.&nbsp; For example
 +
* &nbsp; $ν = 1$&nbsp; $($binary&nbsp; $001)$&nbsp; is followed by&nbsp; $κ = 4$&nbsp; $($binary&nbsp; $100)$,
 +
* &nbsp; $d(2)$&nbsp; remains at the same position&nbsp; $2$&nbsp; $($binary&nbsp; $010)$.
 +
 
 +
 
 +
The actual FFT algorithm happens for the example&nbsp; $N = 8$&nbsp; in&nbsp; $\log_2 N = 3$&nbsp; stages, denoted&nbsp; $L = 1$,&nbsp; $L =2$&nbsp; and&nbsp; $L = 3$.&nbsp; Further:
 +
* In each stage, four basic operations - so-called&nbsp; '''butterflies'''&nbsp; - are to be performed.
 +
* The values at the output of the first stage are designated in this task as&nbsp; $X(0),\hspace{0.03cm}\text{...} \hspace{0.1cm} , X(7)$, <br>those of the second as&nbsp; $Y(0), \hspace{0.03cm}\text{...} \hspace{0.1cm}  , Y(7)$.
 +
* After the third and last stage, all values must be divided by&nbsp; $N$.&nbsp; <br>The final result&nbsp; $D(0), \hspace{0.03cm}\text{...} \hspace{0.1cm}  , D(7)$&nbsp; is available here.
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
 
 +
''Hint:''
 +
*This task belongs to the chapter&nbsp; [[Signal_Representation/Fast_Fourier_Transform_(FFT)|Fast Fourier Transform (FFT)]].
 +
 +
 
 +
 
 +
 
 +
===Questions===
  
 
<quiz display=simple>
 
<quiz display=simple>
{Multiple-Choice Frage
+
 
 +
{Calculate the DFT coefficient&nbsp; $D(\mu=3)$.
 +
|type="{}"}
 +
$D(\mu=3) \ = \ $ { 0. }
 +
 
 +
{Calculate the DFT coefficient&nbsp; $D(\mu=4)$.
 +
|type="{}"}
 +
$D(\mu=4) \ = \ $ { 1 3% }
 +
 
 +
{Determine the initial values&nbsp; $X(0)$, ... , $X(7)$&nbsp; of the first stage.&nbsp; Which of the following statements are true?
 
|type="[]"}
 
|type="[]"}
- Falsch
+
- All&nbsp; $X$ values with even indices are equal to&nbsp; $2$.
+ Richtig
+
+ All&nbsp; $X$ values with odd indices are equal to&nbsp; $0$.
 +
 
 +
{Determine the initial values&nbsp; $Y(0)$, ... , $Y(7)$&nbsp; of the second stage.&nbsp; Enter the values&nbsp; $Y(0)$&nbsp; and&nbsp; $Y(4)$&nbsp; as a check.
  
 +
|type="{}"}
 +
$Y(0) \ = \ $ { 4 3% }
 +
$Y(4) \ = \ $ { -4.12--3.88 }
  
{Input-Box Frage
+
{Calculate all&nbsp; $N$&nbsp; spectral values&nbsp; $D(\mu)$, in particular
 
|type="{}"}
 
|type="{}"}
<math> \alpha = </math> { 0.3 _5 }
+
$D(\mu =3) \ = \ $ { 0. }
 +
$D(\mu = 4) \ = \ $ { 1 3% }
  
 +
{What would be the spectral coefficients for&nbsp; $d(ν = 4) = 1$&nbsp; and&nbsp; $d(ν \neq 4) = 0$&nbsp;? <br>Enter the values&nbsp; $D(\mu =3)$&nbsp; and&nbsp; $D(\mu =4)$&nbsp; as a check.
 +
|type="{}"}
 +
$D(\mu = 3) \ = \ $ { -1.03--0.97 }
 +
$D(\mu = 4) \ = \ $ { 1 3% }
  
  
 
</quiz>
 
</quiz>
  
===Musterlösung===
+
===Solution===
 +
 
 
{{ML-Kopf}}
 
{{ML-Kopf}}
'''1.'''  Antwort 1
+
'''(1)'''&nbsp; According to the general DFT equation given on the specification sheet, with&nbsp; $w = \text{e}^{-\text{j}\hspace{0.05cm} \cdot
 +
\hspace{0.05cm}\pi /4}$&nbsp; taking into account the alternating time coefficients:
 +
 +
:$$8 \cdot D(3)  =    w^0 - w^3 + w^6- w^9+ w^{12}- w^{15}+ w^{18}-
 +
w^{21}  =    w^0 - w^3 + w^2- w^1+ w^{4}- w^{7}+ w^{6}-
 +
w^{5}\hspace{0.05cm}.$$
 +
 
 +
*Here it is taken into account that due to the periodicity&nbsp; $w_9 = w_1$,&nbsp; $w_{12} = w_4$,&nbsp; $w_{15} = w_7$,&nbsp; $w_{18} = w_2$&nbsp; und&nbsp; $w_{21} = w_5$&nbsp; ist.
 +
*After re-sorting, the same applies:
 +
 +
:$$8 \cdot D(3)  =  (w^0 + w^4) - (w^1 + w^5)+ (w^2 + w^6) - (w^3 + w^7) =  (1 + w + w^2+ w^3) \cdot (w^0 + w^4)\hspace{0.05cm}.$$
 +
 
 +
*Thus, because&nbsp; $w_0 = 1$&nbsp; and&nbsp; $w_4 = \text{e}^{-\text{j}\pi } = \hspace{0.08cm} - \hspace{-0.08cm}1$&nbsp;, we obtain&nbsp; $\underline {D(\mu=3) = 0}$.
 +
 
 +
 
 +
'''(2)'''&nbsp; In analogy to sub-taske&nbsp; '''(1)'''&nbsp;, we now get:
 +
 +
:$$ 8 \cdot D(4)  =    w^0 - w^4 + w^8- w^{12}+ w^{16}- w^{20}+
 +
w^{24}- w^{28}=  4 \cdot (w^0 - w^4)= 8 \hspace{0.3cm}
 +
\Rightarrow \hspace{0.3cm}\hspace{0.15 cm}\underline{D(\mu=4) = 1}\hspace{0.05cm}.$$
 +
 
 +
 
 +
[[File:P_ID1178__Sig_A_5_5c_neu.png|right|frame|Example for the FFT algorithm]]
 +
'''(3)'''&nbsp;  <u>Proposed solution 2</u> is correct:
 +
*The term&nbsp; $w^0 = 1$&nbsp; does not have to be taken into account.
 +
*All output values with odd indices are zero by subtracting two identical input values.
 +
*The first statement is not true: &nbsp; It holds&nbsp; $X(0) = X(2) = +2$&nbsp; and&nbsp; $X(4) = X(6) = - 2$.
 +
 
 +
 
 +
 
 +
'''(4)'''&nbsp; The multiplication with&nbsp; $w^{2} = -{\rm j}$&nbsp; can be dispensed with, since in the signal flow diagram the corresponding input values are zero.
 +
*One thus obtains&nbsp; $Y(0) \;\underline{= 4}$&nbsp; and&nbsp; $Y(4) \;\underline{=  - \hspace{-0.03cm}4}$.
 +
*All other values are zero.
 +
 
 +
 
 +
 
 +
'''(5)'''&nbsp; Because of&nbsp; $Y(5) = Y(6) =Y(7) = 0$, the multiplications with&nbsp; $w$,&nbsp; $w^2$&nbsp; and&nbsp; $w^3$&nbsp; do not matter in the third stage either.&nbsp; All spectral coefficients&nbsp; $D(\mu)$&nbsp; therefore result in zero with the exception of
 +
 +
:$$\hspace{0.15 cm}\underline{D(\mu=4)} =  {1}/{N}\cdot \left[Y(0) - Y(4) \right ] \hspace{0.15 cm}\underline{= 1}
 +
\hspace{0.05cm},$$
 +
:$$\hspace{0.15 cm}\underline{D(\mu=3)} = D(\mu\ne 4)  \hspace{0.15 cm}\underline{= 0}
 +
\hspace{0.05cm}.$$
 +
 
 +
This result agrees with the results from&nbsp; '''(1)'''&nbsp; und&nbsp; '''(2)'''.
 +
 
 +
 
 +
 
 +
'''(6)'''&nbsp; Since both the time coefficients&nbsp; $d(ν)$&nbsp; and all spectral coefficients&nbsp; $D(\mu)$&nbsp; are purely real, there is no difference between the FFT and the IFFT.
 +
*This means at the same time:&nbsp; The input and output values can be interchanged.
 +
 
 +
*Subtask&nbsp; '''(5)'''&nbsp; gave the following result:
 +
 +
:$$d({\rm even}\hspace{0.15cm}\nu) =  +1, \hspace{0.2cm}d({\rm
 +
odd}\hspace{0.15cm}\nu)=  -1$$
 +
:$$\Rightarrow
 +
\hspace{0.3cm}D(\mu = 4)= 1,\hspace{0.2cm}D(\mu \ne 4)= 0.$$
 +
 
 +
*By swapping the input and output values, we arrive at problem&nbsp; '''(6)''':
 +
 +
:$$d(\nu = 4)= 1, \hspace{0.2cm}d(\nu \ne 4)= 0 \hspace{0.3cm}
 +
\Rightarrow \hspace{0.3cm}D({\rm gerades}\hspace{0.15cm}\mu) = +1,
 +
\hspace{0.2cm}D({\rm ungerades}\hspace{0.15cm}\mu)= -1
 +
\hspace{0.05cm}.$$
 +
 
 +
*In particular, this results in&nbsp; $D(\mu=3) \; \underline{=  -1}$&nbsp; und&nbsp; $D(\mu=4) \; \underline{= +1}$.
 
{{ML-Fuß}}
 
{{ML-Fuß}}
  
 
__NOEDITSECTION__
 
__NOEDITSECTION__
[[Category:Aufgaben zu Signaldarstellung|^4. Bandpassartige Signale^]]
+
[[Category:Signal Representation: Exercises|^5.5 Fast Fourier Transform ^]]

Latest revision as of 17:08, 21 May 2021

FFT algorithm for  $N=8$

The graph shows the signal flow diagram of the Fast Fourier Transform  $\rm (FFT)$  for  $N = 8$.

The associated spectral coefficients  $D(0), \hspace{0.03cm}\text{...} \hspace{0.1cm} , D(7)$  are determined from the time coefficients  $d(0), \hspace{0.03cm}\text{...} \hspace{0.1cm}, d(7)$.  The following applies to these with  $0 ≤ μ ≤ 7$:

$$D(\mu) = \frac{1}{N}\cdot \sum_{\nu = 0 }^{N-1} d(\nu) \cdot {w}^{\hspace{0.03cm}\nu \hspace{0.05cm} \cdot \hspace{0.05cm}\mu}\hspace{0.05cm},$$

where the complex rotation factor  $w = \text{e}^{-\text{j}\hspace{0.05cm} \cdot \hspace{0.05cm}2\pi /N}$  is to be used, i.e.  $w = \text{e}^{-\text{j}\hspace{0.05cm} \cdot \hspace{0.05cm}\pi /4}$  für  $N = 8$.

  • The alternating $±1$ sequence  $\langle\hspace{0.05cm} d(ν)\hspace{0.05cm}\rangle$  is applied to the input.
  • After the bit reversal operation, this results in the sequence  $\langle \hspace{0.05cm}b(\kappa)\hspace{0.05cm}\rangle$.


It holds that  $b(κ) = d(ν)$, if  $ν$  is represented as a dual number and the resulting three bits are written as  $κ$  in reverse order.  For example

  •   $ν = 1$  $($binary  $001)$  is followed by  $κ = 4$  $($binary  $100)$,
  •   $d(2)$  remains at the same position  $2$  $($binary  $010)$.


The actual FFT algorithm happens for the example  $N = 8$  in  $\log_2 N = 3$  stages, denoted  $L = 1$,  $L =2$  and  $L = 3$.  Further:

  • In each stage, four basic operations - so-called  butterflies  - are to be performed.
  • The values at the output of the first stage are designated in this task as  $X(0),\hspace{0.03cm}\text{...} \hspace{0.1cm} , X(7)$,
    those of the second as  $Y(0), \hspace{0.03cm}\text{...} \hspace{0.1cm} , Y(7)$.
  • After the third and last stage, all values must be divided by  $N$. 
    The final result  $D(0), \hspace{0.03cm}\text{...} \hspace{0.1cm} , D(7)$  is available here.




Hint:



Questions

1

Calculate the DFT coefficient  $D(\mu=3)$.

$D(\mu=3) \ = \ $

2

Calculate the DFT coefficient  $D(\mu=4)$.

$D(\mu=4) \ = \ $

3

Determine the initial values  $X(0)$, ... , $X(7)$  of the first stage.  Which of the following statements are true?

All  $X$ values with even indices are equal to  $2$.
All  $X$ values with odd indices are equal to  $0$.

4

Determine the initial values  $Y(0)$, ... , $Y(7)$  of the second stage.  Enter the values  $Y(0)$  and  $Y(4)$  as a check.

$Y(0) \ = \ $

$Y(4) \ = \ $

5

Calculate all  $N$  spectral values  $D(\mu)$, in particular

$D(\mu =3) \ = \ $

$D(\mu = 4) \ = \ $

6

What would be the spectral coefficients for  $d(ν = 4) = 1$  and  $d(ν \neq 4) = 0$ ?
Enter the values  $D(\mu =3)$  and  $D(\mu =4)$  as a check.

$D(\mu = 3) \ = \ $

$D(\mu = 4) \ = \ $


Solution

(1)  According to the general DFT equation given on the specification sheet, with  $w = \text{e}^{-\text{j}\hspace{0.05cm} \cdot \hspace{0.05cm}\pi /4}$  taking into account the alternating time coefficients:

$$8 \cdot D(3) = w^0 - w^3 + w^6- w^9+ w^{12}- w^{15}+ w^{18}- w^{21} = w^0 - w^3 + w^2- w^1+ w^{4}- w^{7}+ w^{6}- w^{5}\hspace{0.05cm}.$$
  • Here it is taken into account that due to the periodicity  $w_9 = w_1$,  $w_{12} = w_4$,  $w_{15} = w_7$,  $w_{18} = w_2$  und  $w_{21} = w_5$  ist.
  • After re-sorting, the same applies:
$$8 \cdot D(3) = (w^0 + w^4) - (w^1 + w^5)+ (w^2 + w^6) - (w^3 + w^7) = (1 + w + w^2+ w^3) \cdot (w^0 + w^4)\hspace{0.05cm}.$$
  • Thus, because  $w_0 = 1$  and  $w_4 = \text{e}^{-\text{j}\pi } = \hspace{0.08cm} - \hspace{-0.08cm}1$ , we obtain  $\underline {D(\mu=3) = 0}$.


(2)  In analogy to sub-taske  (1) , we now get:

$$ 8 \cdot D(4) = w^0 - w^4 + w^8- w^{12}+ w^{16}- w^{20}+ w^{24}- w^{28}= 4 \cdot (w^0 - w^4)= 8 \hspace{0.3cm} \Rightarrow \hspace{0.3cm}\hspace{0.15 cm}\underline{D(\mu=4) = 1}\hspace{0.05cm}.$$


Example for the FFT algorithm

(3)  Proposed solution 2 is correct:

  • The term  $w^0 = 1$  does not have to be taken into account.
  • All output values with odd indices are zero by subtracting two identical input values.
  • The first statement is not true:   It holds  $X(0) = X(2) = +2$  and  $X(4) = X(6) = - 2$.


(4)  The multiplication with  $w^{2} = -{\rm j}$  can be dispensed with, since in the signal flow diagram the corresponding input values are zero.

  • One thus obtains  $Y(0) \;\underline{= 4}$  and  $Y(4) \;\underline{= - \hspace{-0.03cm}4}$.
  • All other values are zero.


(5)  Because of  $Y(5) = Y(6) =Y(7) = 0$, the multiplications with  $w$,  $w^2$  and  $w^3$  do not matter in the third stage either.  All spectral coefficients  $D(\mu)$  therefore result in zero with the exception of

$$\hspace{0.15 cm}\underline{D(\mu=4)} = {1}/{N}\cdot \left[Y(0) - Y(4) \right ] \hspace{0.15 cm}\underline{= 1} \hspace{0.05cm},$$
$$\hspace{0.15 cm}\underline{D(\mu=3)} = D(\mu\ne 4) \hspace{0.15 cm}\underline{= 0} \hspace{0.05cm}.$$

This result agrees with the results from  (1)  und  (2).


(6)  Since both the time coefficients  $d(ν)$  and all spectral coefficients  $D(\mu)$  are purely real, there is no difference between the FFT and the IFFT.

  • This means at the same time:  The input and output values can be interchanged.
  • Subtask  (5)  gave the following result:
$$d({\rm even}\hspace{0.15cm}\nu) = +1, \hspace{0.2cm}d({\rm odd}\hspace{0.15cm}\nu)= -1$$
$$\Rightarrow \hspace{0.3cm}D(\mu = 4)= 1,\hspace{0.2cm}D(\mu \ne 4)= 0.$$
  • By swapping the input and output values, we arrive at problem  (6):
$$d(\nu = 4)= 1, \hspace{0.2cm}d(\nu \ne 4)= 0 \hspace{0.3cm} \Rightarrow \hspace{0.3cm}D({\rm gerades}\hspace{0.15cm}\mu) = +1, \hspace{0.2cm}D({\rm ungerades}\hspace{0.15cm}\mu)= -1 \hspace{0.05cm}.$$
  • In particular, this results in  $D(\mu=3) \; \underline{= -1}$  und  $D(\mu=4) \; \underline{= +1}$.