Difference between revisions of "Signal Representation/Possible Errors when using DFT"

From LNTwww
 
(45 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
   
 
   
 
{{Header
 
{{Header
|Untermenü=Zeit- und frequenzdiskrete Signaldarstellung
+
|Untermenü=Time and Frequency-Discrete Signal Representation
|Vorherige Seite=Diskrete Fouriertransformation (DFT)
+
|Vorherige Seite=Discrete Fourier Transform (DFT)
|Nächste Seite=Spektralanalyse
+
|Nächste Seite=Spectrum Analysis
 
}}
 
}}
  
==Der mittlere quadratische Fehler als Qualitätskriterium==
+
==The mean square error as a quality criteria==
 +
<br>
 +
In the following,&nbsp; we briefly discuss some error possibilities when applying the DFT,&nbsp; whereby we restrict ourselves to the transformation from the time to the frequency domain.&nbsp; Even in its samples,&nbsp; the spectrum&nbsp; $D(\mu )/f_{\rm A}$&nbsp; determined via the DFT will generally differ from the actual spectrum&nbsp; $X(\mu \cdot f_{\rm A})$&nbsp; due to two processes:
 +
*the&nbsp; &raquo;sampling&laquo;,&nbsp; that is,&nbsp; the reduction of information about&nbsp; $x(t)$&nbsp; to&nbsp; $N$&nbsp; numerical values,
  
Im Folgenden werden einige Fehlermöglichkeiten bei Anwendung der DFT kurz diskutiert, wobei wir uns auf die Transformation vom Zeit– in den Frequenzbereich beschränken. Auch in seinen Abtastwerten wird sich im Allgemeinen das über die DFT ermittelte Spektrum $D(\mu )/f_{\rm A}$ vom tatsächlichen Spektrum $X(\mu \cdot f_{\rm A})$ unterscheiden, was auf zwei Prozesse zurückzuführen ist:
+
*the&nbsp; &raquo;windowing&raquo; that may falsely limit the signal&nbsp; $x(t)$.
*die Abtastung, also die Reduzierung der Information über $x(t)$ auf $N$ Zahlenwerte,
 
*die Fensterung, die das Signal $x(t)$ eventuell fälschlicherweise begrenzt.
 
  
  
Ein Gütekriterium, das beide Fehlerarten berücksichtigt, ist der '''mittlere quadratische Fehler''':
+
{{BlaueBox|TEXT=
 +
$\text{Definition:}$&nbsp;
 +
A quality criteria that takes both error types into account is the&nbsp; &raquo;'''mean square error'''&laquo;&nbsp; $($German:&nbsp; "mittlerer quadratischer Fehler" &nbsp; &rArr; &nbsp;$\rm MQF)$:
 
   
 
   
$${\rm MQF} =  \frac{1}{N}\cdot \sum_{\mu = 0 }^{N-1}
+
:$${\rm MQF} =  \frac{1}{N}\cdot \sum_{\mu = 0 }^{N-1}
  \left|X(\mu \cdot f_{\rm A})-\frac{D(\mu)}{f_{\rm A}}\right|^2 \hspace{0.05cm}.$$
+
  \left\vert X(\mu \cdot f_{\rm A})-\frac{D(\mu)}{f_{\rm A} }\right \vert^2 \hspace{0.05cm}.$$
  
Dieser ist stets ungleich 0. Die Größe von MQF hängt von folgenden Parametern ab:
+
It is always&nbsp; ${\rm MQF} \ne 0$,&nbsp; since with finite&nbsp; $N$&nbsp; the degradation due to sampling and due to windowing cannot be made zero at the same time.}}  
*den Eigenschaften der vorliegenden Zeitfunktion $x(t)$ bzw. des Spektrums $X(f)$,
 
*dem DFT–Parameter $N$; je größer $N$ gewählt wird, umso kleiner wird MQF,
 
*einem der vier weiteren DFT–Parameter, zum Beispiel $f_{\rm A}$. Die weiteren Parameter sind über die Gleichungen $f_{\rm P} = N \cdot f_{\rm A}, T_{\rm P} = 1/f_{\rm A}$ und $T_{\rm A} = T_{\rm P}/N$ festgelegt.
 
  
  
Wir weisen Sie bereits hier auf das Lernvideo [[Fehlermöglichkeiten bei Anwendung der DFT]] hin, das den Inhalt dieses Kapitels verdeutlicht.  
+
The magnitude of this evaluation quantity&nbsp; ${\rm MQF}$&nbsp; depends on the following parameters:
 +
#The properties of the present signal&nbsp; $x(t)$&nbsp; and of its spectrum&nbsp; $X(f)$,
 +
#the DFT parameter&nbsp; $N$; &nbsp; the larger&nbsp; $N$&nbsp; is chosen,&nbsp; the smaller&nbsp; ${\rm MQF}$&nbsp; becomes,
 +
#one of the four further DFT parameters,&nbsp; e.g.&nbsp; $f_{\rm A}$.  
  
  
{{Beispiel}}
+
For a given&nbsp; $N$&nbsp; the other DFT parameters are determined via the equations&nbsp;
Wir betrachten beispielhaft einen Gaußimpuls mit der äquivalenten Impulsdauer $\Delta t = T$ ($T$ ist lediglich ein Normierungsparameter):
+
:$$f_{\rm P} = N \cdot f_{\rm A},$$
 +
:$$T_{\rm P} = 1/f_{\rm A},$$
 +
:$$T_{\rm A} = T_{\rm P}/N.$$
 +
 
 +
We refer you already here to the following&nbsp; $($German language$)$&nbsp; learning video,&nbsp; which clarifies the content of this chapter:<br>&nbsp; &nbsp; [[Fehlermöglichkeiten_bei_Anwendung_der_DFT_(Lernvideo)|&raquo;Fehlermöglichkeiten bei Anwendung der DFT&laquo;]] &nbsp; &rArr; &nbsp; "Possible errors when using the DFT".
 +
 
 +
{{GraueBox|TEXT=
 +
$\text{Example 1:}$&nbsp;
 +
As an example,&nbsp; we consider a Gaussian pulse with equivalent pulse duration&nbsp; $\Delta t = T$,&nbsp; where&nbsp; $T$&nbsp; is simultaneously used as a normalization parameter:
 +
[[File:EN_Sig_T_5_1_S1.png|right|frame|Quasi error-free DFT  with &nbsp; $N = 16$; &nbsp; &nbsp; ${\rm MQF}$: &nbsp; mean square error &nbsp; &nbsp; <u>Note:</u><br>The given&nbsp; $\text{MQF}$ values apply to a&nbsp; 16 bit processor.&nbsp; For a 32 bit processor&nbsp; $($smaller quantization errors of the computer$)$&nbsp; $\text{MQF}$&nbsp; would be even smaller,&nbsp; but never zero.]]
 
   
 
   
$$x(t) = {\rm e}^{- \pi (t/T)^2} \hspace{0.05cm}.$$
+
:$$x(t) = {\rm e}^{- \pi (t/T)^2} \hspace{0.05cm}.$$
  
Der Gaußimpuls eignet sich aufgrund des schnellen, exponentiellen Abklingens sowohl im Zeit– als auch im Frequenzbereich sehr gut für die Anwendung der DFT. Die folgende Grafik zeigt das Ergebnis der DFT für $N = 16$ und $T_{\rm A}/T = 0.25$. Damit gilt auch: $f_{\rm A} \cdot T = 0.25$.
+
The Gaussian pulse is very suitable for the application of the  DFT due to its fast&nbsp; $($exponential$)$&nbsp; decay in both time and frequency domain.  
  
[[File:P_ID1142__Sig_T_5_3_S1_neu.png|Quasi-fehlerfreie DFT mit N = 16]]
+
The graph below shows the DFT result
 +
*for&nbsp; $N = 16$&nbsp; and
 +
*$T_{\rm A}/T = 0.25$ &nbsp; &rArr; &nbsp; $f_{\rm A} \cdot T = 0.25$ &nbsp; &rArr; &nbsp; $T_{\rm P}/T = 4$.
  
Zu dieser Darstellung ist Folgendes anzumerken:
 
*Die berücksichtigten Abtastwerte von $x(t)$ liegen im Bereich $|t/T| ≤ 2$. Da $x(\pm 2T)$ sehr klein ist, führt die Periodifizierung im Zeitbereich mit $T_{\rm P}/T = N \cdot T_{\rm A}/T = 2$ zu keinen gravierenden Fehlern.
 
*Mit $f_{\rm A} \cdot T = 0.25$ sowie $N = 16$ ergibt sich der (normierte) DFT–Parameter $f_{\rm P} \cdot T = 4$. Die diskreten Spektrallinien der DFT liegen somit im Bereich $–2/T ≤  f  < +2/T$.
 
*Der mittlere quadratrische Fehler ist mit $\text{MQF} \approx 10^{–12}$ relativ klein, was auf die günstige Wahl von $f_{\rm A} \cdot T = 0.25$ (bei gegebenem  $N = 16$) zurückzuführen ist.
 
*Die DFT–Genauigkeit kann durch Vergrößerung von $N$ verbessert werden. Für $N = 1024$ erhält man den kleinstmöglichen Wert $\text{MQF} \approx 8 \cdot 10^{–17}$, wenn $f_{\rm A} \cdot T = 0.125$ gewählt wird. Für die drei weiteren DFT–Parameter gilt dann:
 
: $$f_{\rm P} \cdot T = 128, \hspace{0.5cm}T_{\rm A}/T = 1/128,  \hspace{0.5cm} T_{\rm P}/T = N \cdot T_{\rm A}/T= 8.$$
 
  
{{end}}
+
The following should be noted about this plot:
 +
#The considered samples of&nbsp; $x(t)$&nbsp; are in the range&nbsp; $\vert t/T \vert≤ 2$.&nbsp; Since&nbsp; $x(\pm 2T)$&nbsp; is very small,&nbsp; periodization in time domain with&nbsp; $T_{\rm P}/T = N \cdot T_{\rm A}/T = 4$&nbsp; does not lead to serious errors.
 +
#With&nbsp; $f_{\rm A} \cdot T = 0.25$&nbsp; and&nbsp; $N = 16$&nbsp; the&nbsp; $($normalized$)$&nbsp; DFT parameter is&nbsp; $f_{\rm P} \cdot T = 4$.&nbsp; The discrete spectral lines thus lie in the range&nbsp; $-2/T ≤ f < +2/T$.
 +
#The mean squared error is relatively small&nbsp; $\text{(MQF} \approx 10^{-12})$,&nbsp; which is due to the favourable choice of&nbsp; $f_{\rm A} \cdot T = 0.25$&nbsp; $($for the given&nbsp; $N = 16)$&nbsp;.
 +
#The DFT accuracy can be improved by increasing&nbsp; $N$&nbsp;:
 +
#For&nbsp; $N = 1024$&nbsp; the minimum value&nbsp; $\text{MQF} \approx 8 \cdot 10^{-17}$&nbsp;  is obtained,&nbsp; if&nbsp; $f_{\rm A} \cdot T = 0.125$&nbsp; is chosen.
 +
#The following then applies to the other DFT parameters:
 +
:: $$f_{\rm P} \cdot T = 128, \hspace{0.5cm}T_{\rm A}/T = 1/128, \hspace{0.5cm} T_{\rm P}/T = N \cdot T_{\rm A}/T= 8.$$ }}
  
  
==DFT - Verfälschung durch Fensterung - Abbruchfehler==
+
==DFT falsification due to windowing &ndash; Truncation error==
 +
<br>
 +
A typical error when using the DFT is due to&nbsp; &raquo;windowing&laquo;.&nbsp; This falsification, known&nbsp; as&nbsp; &raquo;'''truncation error'''&laquo;&nbsp; can be explained as follows:
 +
#The windowing implicit in the DFT algorithm corresponds to the multiplication of the signal&nbsp; $x(t)$&nbsp; by&nbsp; a rectangular function of height&nbsp; $1$&nbsp; and duration&nbsp; $T_{\rm P} = N \cdot T_{\rm A}$.
 +
#If the signal&nbsp; $x(t)$&nbsp; is not limited to the range&nbsp; $T_{\rm P}$&nbsp; the DFT result does not coincide with the actual spectrum&nbsp; $X(f)$&nbsp; but is obtained from it by convolution with the spectral function&nbsp; $T_{\rm P} \cdot \text{sinc}(f\cdot T_{\rm P})$.
 +
#In the limiting case&nbsp; $T_{\rm P} \to \infty$,&nbsp; which for a given distance&nbsp; $T_{\rm A}$&nbsp; of the samples would also mean an infinitely large number&nbsp; $N$&nbsp; of interpolation points,&nbsp; $T_{\rm P} \cdot \text{sinc}(f\cdot T_{\rm P})$ degenerates&nbsp; to a Dirac delta function and the original spectrum&nbsp; $X(f)$&nbsp; would remain.
 +
#The DFT of an unlimited signal in time &ndash; for example a periodic signal &ndash; will always cause a truncation error which can only be kept within limits by special measures.&nbsp; This is discussed in more detail in the chapter&nbsp; [[Signal_Representation/Spectrum_Analysis|&raquo;Spectrum Analysis&laquo;]].
 +
#For time-limited signals &nbsp; &rArr; &nbsp; &raquo;pulses&laquo;,&nbsp; the truncation error can be avoided by choosing&nbsp; $T_{\rm P}$&nbsp; sufficiently large.&nbsp; By further enlarging the window into areas with&nbsp; $x(t) \equiv 0$&nbsp; no additional information gain results &nbsp; ⇒ &nbsp; $\text{MQF}$&nbsp; does not become smaller.
 +
#By this addition of zeros called&nbsp; &raquo;'''zero-padding'''&laquo;&nbsp; the&nbsp; $X(f)$&nbsp; samples now occur at a smaller distance&nbsp; $f_{\rm A} = 1/T_{\rm A}$.&nbsp; By doubling&nbsp; $T_{\rm P}$&nbsp; one achieves an interpolation of the frequency samples exactly in the middle between two previous grid points.
  
Ein typischer Fehler bei Anwendung der DFT ist auf die '''Fensterung''' zurückzuführen. Diese als ''Abbruchfehler'' bekannte Verfälschung lässt sich folgendermaßen erklären:
 
*Die im DFT–Algorithmus impliziert enthaltene Fensterung entspricht der Multiplikation des Signals $x(t)$ mit einer Rechteckfunktion der Höhe 1 und der Dauer $T_{\rm P} = N \cdot T_{\rm A}$.
 
*Ist das Zeitsignal $x(t)$ nicht auf $T_{\rm P}$ begrenzt, so stimmt das DFT–Ergebnis nicht mit dem tatsächlichen Spektrum $X(f)$ überein, sondern ergibt sich aus diesem durch Faltung mit der Spektralfunktion $T_{\rm P} \cdot \text{si}(\pi fT_{\rm P})$.
 
*Im Grenzfall $T_{\rm P} \to \infty$, was bei gegebenem Abstand $T_{\rm A}$ der Abtastwerte auch eine unendlich große Stützstellenzahl $N$ bedeuten würde, entartet $T_{\rm P} \cdot \text{si}(\pi fT_{\rm P})$ zu einer Diracfunktion und das Originalspektrum $X(f)$ bliebe erhalten.
 
*Die DFT eines zeitlich unbegrenzten Signals – zum Beispiel eines periodischen Signals – wird immer einen Abbruchfehler hervorrufen, der nur durch besondere Maßnahmen in Grenzen gehalten werden kann. Hierauf wird in Kapitel [[Signaldarstellung/Spektralanalyse]] noch näher eingegangen.
 
*Bei zeitlich begrenzten, impulsartigen Signalen lässt sich der Abbruchfehler vermeiden, wenn man $T_{\rm P}$ hinreichend groß wählt. Durch weitere Vergrößerung des Fensters in Bereiche mit $x(t) \approx 0$ ergibt sich kein zusätzlicher Informationsgewinn  ⇒  MQF wird nicht kleiner.
 
*Durch dieses Anfügen von Nullen ('''zero–padding''') treten nun die Abtastwerte von $X(f)$ in kleinerem Abstand $f_{\rm A} = 1/T_{\rm A}$ auf. Durch $T_{\rm P}$–Verdopplung erreicht man eine Interpolation der Frequenzabtastwerte genau in der Mitte zwischen zwei vorherigen Stützstellen.
 
  
 +
The following example shows a&nbsp; &raquo;truncation error&laquo;&nbsp; due to unfavourably chosen DFT parameters.&nbsp; Again,&nbsp; we refer to the learning video&nbsp; $($in German language$)$&nbsp; <br>&nbsp; &nbsp; [[Fehlermöglichkeiten_bei_Anwendung_der_DFT_(Lernvideo)|&raquo;Fehlermöglichkeiten bei Anwendung der DFT&laquo;]] &nbsp; &rArr; &nbsp; "Possible errors when using the DFT".
  
Das folgende Beispiel zeigt einen Abbruchfehler aufgrund ungünstig gewählter DFT–Parameter.
+
{{GraueBox|TEXT=
 +
$\text{Example 2:}$&nbsp;
 +
The graph shows the DFT result for the same&nbsp; $x(t)$&nbsp; and&nbsp; $X(f)$&nbsp; as well as the same&nbsp; $N = 16$&nbsp; as in&nbsp; [[Signal_Representation/Possible_Errors_when_using_DFT#The_mean_square_error_as_a_quality_criteria|$\text{Example 1}$]],&nbsp; but now with finer sampling in the time domain by a factor of&nbsp; $2$ &nbsp; &rArr; &nbsp; $T_{\rm A}/T = 0.125$
 +
[[File:EN_Sig_T_5_1_S2.png|right|frame|Truncation error for a DFT with&nbsp; $N = 16$; &nbsp; &nbsp; ${\rm MQF}$: &nbsp; Mean square error]]
 +
 +
The comparison with&nbsp; [[Signal_Representation/Possible_Errors_when_using_DFT#The_mean_square_error_as_a_quality_criteria|$\text{Example 1}$]]&nbsp; shows:
 +
*The spacing of the frequency samples increases from&nbsp; $f_{\rm A} \cdot T = 0.25$&nbsp; to&nbsp; $f_{\rm A} \cdot T = 0.5$ .
  
{{Beispiel}}
+
*At the same time,&nbsp; $T_{\rm P}/T$&nbsp; decreases from&nbsp; $4$&nbsp; to&nbsp; $2$.
Die Grafik zeigt das Ergebnis der DFT für gleiches $x(t)$ und $X(f)$ wie auf der letzten Seite, aber nun mit den DFT–Parametern $N = 16$ und $T_{\rm A}/T = 0.125$.
 
  
[[File:P_ID1143__Sig_T_5_3_S2_neu.png|Abbruchfehler bei einer DFT mit N = 16]]
+
*With this,&nbsp; only the signal components in the range&nbsp; $\vert t \vert < T$&nbsp; are now captured by the DFT.
  
Aus dem Vergleich mit der [[Signaldarstellung/Fehlermöglichkeiten_bei_Anwendung_der_DFT#Der_mittlere_quadratische_Fehler_Qualit.C3.A4tskriterium|vorherigen Grafik]] (gültig für $T_{\rm A}/T = 0.25$) erkennt man:
 
*Die Frequenzabtastwerte treten nun mit doppelt so großem Abstand auf: $f_{\rm A} \cdot T = 0.5$.
 
*Gleichzeitig verringert sich $T_{\rm P}/T$ von $4$ auf $2$.
 
*Damit werden nun nur noch die Signalanteile im Bereich $|t| < T$ durch die DFT erfasst.
 
  
  
Mit diesen DFT–Parametern entsteht ein '''Abbruchfehler''', durch den der mittlere quadratische Fehler (MQF) signifikant von $10^{–12}$ auf $4 \cdot 10^{–5}$ vergrößert wird.
 
  
{{end}}
+
&rArr; &nbsp; With these parameters,&nbsp; a&nbsp; &raquo;truncation error&laquo; or&nbsp; &raquo;termination error&laquo; arises,&nbsp; by which the mean square error&nbsp; is significantly increased from&nbsp; $\rm MQF= 10^{-12}$&nbsp; to&nbsp; $\rm MQF= 4 \cdot 10^{-5}$.
 +
}}
  
  
==DFT - Verfälschung durch Abtastung - Aliasingfehler==
 
  
Auch durch eine ungeeignete Abtastung der Zeitfunktion $x(t)$ kann es zu einer Verfälschung des DFT–Ergebnisses kommen. Dieser so genannte Aliasingfehler lässt sich wie folgt erklären:
+
==DFT falsification due to sampling &ndash; Aliasing error==
*Die Abtastung von $x(t)$ im Abstand $T_{\rm A}$ bewirkt eine periodische Fortsetzung des Spektrums bei ganzzahligen Vielfachen der Periodisierungsfrequenz $f_{\rm P} = 1/T_{\rm A}$.
+
<br>
*Besitzt das Spektrum $X(f)$ auch Spektralanteile bei $|f| > f_{\rm P}/2$, so ist das Abtasttheorem nicht erfüllt und es kommt zu Überlappungen der zu addierenden, verschobenen Frequenzanteile.
 
*Nur bei bandbegrenztem Signal kann der Aliasingfehler durch geeignete DFT–Parameter vermieden werden. Dagegen ist bei zeitlich begrenzten, impulsartigen Signalen dieser Fehler unvermeidbar, da zeitbegrenzte Signale nicht gleichzeitig bandbegrenzt sein können.
 
*Der Aliasingfehler wird durch eine feinere Abtastung (also: kleineres $T_{\rm A} = 1/f_{\rm P}$) kleiner. Dies erreicht man bei gleichbleibendem $T_{\rm A}$ – um den Abbruchfehler nicht anwachsen zu lassen – allerdings nur durch ein größeres $N$ und damit einen größeren Rechenaufwand.
 
  
 +
An unsuitable sampling of the time function&nbsp; $x(t)$&nbsp; can also significantly falsify the DFT result.&nbsp; This so-called&nbsp; &raquo;'''aliasing error'''&laquo;&nbsp; can be explained as follows:
 +
*Sampling&nbsp; $x(t)$&nbsp; at a distance&nbsp; $T_{\rm A}$&nbsp; causes a periodic continuation of the spectrum at multiples of the periodization frequency&nbsp; $f_{\rm P} = 1/T_{\rm A}$.
  
Wir weisen Sie nochmals auf unser Lernvideo [[Fehlermöglichkeiten bei Anwendung der DFT]] hin.
+
*If&nbsp; $X(f)$&nbsp; has spectral components at&nbsp; $|f| > f_{\rm P}/2$,&nbsp; the sampling theorem is not fulfilled and overlaps of the shifted frequency components to be added occur.
  
Das folgenmde Beispiel zeigt einen solchen Aliasingfehler aufgrund falsch gewählter DFT–Parameter ($T_{\rm A}$ zu groß, $f_{\rm A}$ zu klein).
+
*Only with a band-limited signal the aliasing error can be avoided by suitable DFT parameters.&nbsp; In contrast,&nbsp; this error is unavoidable with time-limited signals &nbsp; &rArr; &nbsp; &raquo;pulses&laquo;,&nbsp; since time-limited signals cannot be band-limited at the same time.
  
{{Beispiel}}
+
*The aliasing error is reduced by finer sampling&nbsp; $($smaller&nbsp; $T_{\rm A} = 1/f_{\rm P})$.&nbsp; This can only be achieved with a constant&nbsp; $T_{\rm A}$&nbsp; &ndash; in order not to let the truncation error increase &ndash; by a larger&nbsp; $N$&nbsp; and thus a greater computational effort.
Die folgende Grafik verdeutlicht den Aliasingfehler bei gaußförmigem $x(t)$ bzw. $X(f)$. Es gelten die DFT–Parameter $N = 16$ und $f_{\rm A} \cdot T= 0.125$. Vergleichen Sie das DFT–Ergebnis mit der [[Signaldarstellung/Fehlermöglichkeiten_bei_Anwendung_der_DFT#Der_mittlere_quadratische_Fehler_Qualit.C3.A4tskriterium|Grafik bei günstigerer Frequenzauflösung]] ($f_{\rm A} \cdot T = 0.25$, ebenfalls für $N = 16$) &nbsp; &rArr;&nbsp; &bdquo;Vergleichssystem&rdquo;.
 
  
[[File:P_ID2733__Sig_T_5_3_S3_neu.png|Aliasingfehler bei einer DFT mit N = 16]]
 
  
Mit $N = 16$ und $f_{\rm A} \cdot T = 0.125$ gilt für die drei weiterten DFT–Parametern:
+
The following&nbsp; $\text{Example 3}$&nbsp; shows such an aliasing error due to wrongly chosen DFT parameters:  
* $T_{\rm P}/T = 8$ (beim Vergleichssystem: $T_{\rm P}/T = 4$),
+
*Compared to the&nbsp; comparison system&nbsp; according to&nbsp; [[Signal_Representation/Possible_Errors_when_using_DFT#The_mean_square_error_as_a_quality_criteria|$\text{Example 1}$]]: &nbsp; &nbsp;  $T_{\rm A}$&nbsp; is too large and&nbsp; $f_{\rm A}$&nbsp; is too small dimensioned.
* $f_{\rm P} \cdot T = 2$ (beim Vergleichssystem: $f_{\rm P} \cdot T = 4$),
+
* $T_{\rm A}/T = 0.5$ (beim Vergleichssystem: $T_{\rm A}/T = 0.25$).
+
*The number of interpolation points is in both cases:&nbsp; $N = 16$.
 +
 
  
 +
{{GraueBox|TEXT=
 +
$\text{Example 3:}$&nbsp;
 +
Let the DFT parameters be&nbsp; $N = 16$&nbsp; and&nbsp; $f_{\rm A} \cdot T= 0.125$. Thus,&nbsp;  we get for the other three DFT parameters:
 +
[[File:EN_Sig_T_5_1_S3._neu.png|right|frame|Aliasing error of a DFT with&nbsp; $N = 16$; &nbsp; &nbsp; ${\rm MQF}$: &nbsp; mean square error]]
 +
* $T_{\rm P}/T = 8 \hspace{0.8cm} \text{(Example 1:} \ \ T_{\rm P}/T = 4)$,
 +
* $f_{\rm P} \cdot T = 2 \hspace{0.75cm} \text{(Example 1:} \ \ f_{\rm P} \cdot T = 4)$,
 +
* $T_{\rm A}/T = 0.5\hspace{0.45cm} \text{(Example 1:} \ \ T_{\rm A}/T = 0.25)$.
  
Daraus ergeben sich folgende Konsequenzen:
 
*Der Abbruchfehler spielt wegen $T_{\rm P} /T = 8$ keine Rolle (schon $T_{\rm P} /T = 4$ war ausreichend).
 
*Wegen $f_{\rm P}  \cdot T = 2$ entsteht nun allerdings Aliasing, weil die DFT von der Summe vieler Gaußfunktionen im Abstand $f_{\rm P}  \cdot T = 2$ ausgeht (gestrichelten Kurven in der Grafik ).
 
*Somit ergibt sich hier mit $\text{MQF} \approx 2 \cdot 10^{-4}$ ein noch größerer Fehlerwert als durch den Abbruchfehler im letzten Beispiel.
 
  
 +
This results in the following consequences:
 +
#The truncation error continues to play no role because of&nbsp; $T_{\rm P} /T = 8$&nbsp; $($already&nbsp; $T_{\rm P} /T = 4$&nbsp; was sufficient$)$.
 +
#However,&nbsp; aliasing now arises,&nbsp; because the DFT is derived from many Gaussian functions at distance&nbsp; $f_{\rm P}  \cdot T = 2$&nbsp; $($thin dashed curves in the graph$)$.
 +
#The DFT coefficients are falsified differently: &nbsp; The mean DFT coefficient&nbsp; $($for&nbsp; $f = 0)$&nbsp; is almost correct, while the errors of the DFT coefficients increase significantly towards the edges.
 +
#Here,&nbsp; the DFT coefficient for&nbsp; $f \cdot T = -1$&nbsp; is twice as large as it should be,&nbsp; since the Gaussian function with the center at&nbsp; $f \cdot T = -2$&nbsp; gives the same contribution as the Gaussian function around&nbsp; $f \cdot T = 0$&nbsp; (see yellow background).
  
Die einzelnen DFT–Koeffizienten werden unterschiedlich verfälscht:
 
*Der mittlere DFT–Koeffizient (für die Frequenz $f = 0$) ist nahezu richtig, während die Fehler der DFT–Koeffizienten zu den Rändern hin deutlich zunehmen.
 
*Der DFT–Koeffizient für $f \cdot T = –1$ ist beispielsweise doppelt so groß als er sein sollte, da die Gaußfunktion mit dem Zentrum bei $f \cdot T = –2$ den gleichen Beitrag liefert wie die eigentliche Gaußfunktion um $f \cdot T = 0$ (siehe gelbe Hinterlegung).
 
  
{{end}}
+
Thus,&nbsp; here with&nbsp; $\text{MQF} \approx 2 \cdot 10^{-4}$&nbsp; an error value four times larger than that caused by the truncation error in&nbsp; [[Signal_Representation/Possible_Errors_when_using_DFT#DFT_falsification_due_to_windowing_.E2.80.93_Truncation_error|$\text{Example 2}$]].
  
 +
Again,&nbsp; we refer to the&nbsp; $($German language$)$&nbsp; learning video:<br> &nbsp; &nbsp;[[Fehlermöglichkeiten_bei_Anwendung_der_DFT_(Lernvideo)|&raquo;Fehlermöglichkeiten bei Anwendung der DFT&laquo;]] &nbsp; &rArr; &nbsp; "Possible errors when using the DFT". }}
  
==Aufgaben zum Kapitel==
 
  
[[Aufgaben:5.3 Mittlerer Quadratischer Fehler|A5.3 Mittlerer Quadratischer Fehler]]
+
==Exercises for the chapter==
 +
<br>
 +
[[Aufgaben:Exercise 5.3: Mean Square Error|Exercise 5.3: Mean Square Error]]
  
[[Aufgaben:5.3Z Zero-Padding|Z5.3 Zero-Padding]]
+
[[Aufgaben:Exercise 5.3Z: Zero-Padding|Exercise 5.3Z: Zero-Padding]]
  
  
 
{{Display}}
 
{{Display}}

Latest revision as of 17:16, 24 June 2023

The mean square error as a quality criteria


In the following,  we briefly discuss some error possibilities when applying the DFT,  whereby we restrict ourselves to the transformation from the time to the frequency domain.  Even in its samples,  the spectrum  $D(\mu )/f_{\rm A}$  determined via the DFT will generally differ from the actual spectrum  $X(\mu \cdot f_{\rm A})$  due to two processes:

  • the  »sampling«,  that is,  the reduction of information about  $x(t)$  to  $N$  numerical values,
  • the  »windowing» that may falsely limit the signal  $x(t)$.


$\text{Definition:}$  A quality criteria that takes both error types into account is the  »mean square error«  $($German:  "mittlerer quadratischer Fehler"   ⇒  $\rm MQF)$:

$${\rm MQF} = \frac{1}{N}\cdot \sum_{\mu = 0 }^{N-1} \left\vert X(\mu \cdot f_{\rm A})-\frac{D(\mu)}{f_{\rm A} }\right \vert^2 \hspace{0.05cm}.$$

It is always  ${\rm MQF} \ne 0$,  since with finite  $N$  the degradation due to sampling and due to windowing cannot be made zero at the same time.


The magnitude of this evaluation quantity  ${\rm MQF}$  depends on the following parameters:

  1. The properties of the present signal  $x(t)$  and of its spectrum  $X(f)$,
  2. the DFT parameter  $N$;   the larger  $N$  is chosen,  the smaller  ${\rm MQF}$  becomes,
  3. one of the four further DFT parameters,  e.g.  $f_{\rm A}$.


For a given  $N$  the other DFT parameters are determined via the equations 

$$f_{\rm P} = N \cdot f_{\rm A},$$
$$T_{\rm P} = 1/f_{\rm A},$$
$$T_{\rm A} = T_{\rm P}/N.$$

We refer you already here to the following  $($German language$)$  learning video,  which clarifies the content of this chapter:
    »Fehlermöglichkeiten bei Anwendung der DFT«   ⇒   "Possible errors when using the DFT".

$\text{Example 1:}$  As an example,  we consider a Gaussian pulse with equivalent pulse duration  $\Delta t = T$,  where  $T$  is simultaneously used as a normalization parameter:

Quasi error-free DFT with   $N = 16$;     ${\rm MQF}$:   mean square error     Note:
The given  $\text{MQF}$ values apply to a  16 bit processor.  For a 32 bit processor  $($smaller quantization errors of the computer$)$  $\text{MQF}$  would be even smaller,  but never zero.
$$x(t) = {\rm e}^{- \pi (t/T)^2} \hspace{0.05cm}.$$

The Gaussian pulse is very suitable for the application of the DFT due to its fast  $($exponential$)$  decay in both time and frequency domain.

The graph below shows the DFT result

  • for  $N = 16$  and
  • $T_{\rm A}/T = 0.25$   ⇒   $f_{\rm A} \cdot T = 0.25$   ⇒   $T_{\rm P}/T = 4$.


The following should be noted about this plot:

  1. The considered samples of  $x(t)$  are in the range  $\vert t/T \vert≤ 2$.  Since  $x(\pm 2T)$  is very small,  periodization in time domain with  $T_{\rm P}/T = N \cdot T_{\rm A}/T = 4$  does not lead to serious errors.
  2. With  $f_{\rm A} \cdot T = 0.25$  and  $N = 16$  the  $($normalized$)$  DFT parameter is  $f_{\rm P} \cdot T = 4$.  The discrete spectral lines thus lie in the range  $-2/T ≤ f < +2/T$.
  3. The mean squared error is relatively small  $\text{(MQF} \approx 10^{-12})$,  which is due to the favourable choice of  $f_{\rm A} \cdot T = 0.25$  $($for the given  $N = 16)$ .
  4. The DFT accuracy can be improved by increasing  $N$ :
  5. For  $N = 1024$  the minimum value  $\text{MQF} \approx 8 \cdot 10^{-17}$  is obtained,  if  $f_{\rm A} \cdot T = 0.125$  is chosen.
  6. The following then applies to the other DFT parameters:
$$f_{\rm P} \cdot T = 128, \hspace{0.5cm}T_{\rm A}/T = 1/128, \hspace{0.5cm} T_{\rm P}/T = N \cdot T_{\rm A}/T= 8.$$


DFT falsification due to windowing – Truncation error


A typical error when using the DFT is due to  »windowing«.  This falsification, known  as  »truncation error«  can be explained as follows:

  1. The windowing implicit in the DFT algorithm corresponds to the multiplication of the signal  $x(t)$  by  a rectangular function of height  $1$  and duration  $T_{\rm P} = N \cdot T_{\rm A}$.
  2. If the signal  $x(t)$  is not limited to the range  $T_{\rm P}$  the DFT result does not coincide with the actual spectrum  $X(f)$  but is obtained from it by convolution with the spectral function  $T_{\rm P} \cdot \text{sinc}(f\cdot T_{\rm P})$.
  3. In the limiting case  $T_{\rm P} \to \infty$,  which for a given distance  $T_{\rm A}$  of the samples would also mean an infinitely large number  $N$  of interpolation points,  $T_{\rm P} \cdot \text{sinc}(f\cdot T_{\rm P})$ degenerates  to a Dirac delta function and the original spectrum  $X(f)$  would remain.
  4. The DFT of an unlimited signal in time – for example a periodic signal – will always cause a truncation error which can only be kept within limits by special measures.  This is discussed in more detail in the chapter  »Spectrum Analysis«.
  5. For time-limited signals   ⇒   »pulses«,  the truncation error can be avoided by choosing  $T_{\rm P}$  sufficiently large.  By further enlarging the window into areas with  $x(t) \equiv 0$  no additional information gain results   ⇒   $\text{MQF}$  does not become smaller.
  6. By this addition of zeros called  »zero-padding«  the  $X(f)$  samples now occur at a smaller distance  $f_{\rm A} = 1/T_{\rm A}$.  By doubling  $T_{\rm P}$  one achieves an interpolation of the frequency samples exactly in the middle between two previous grid points.


The following example shows a  »truncation error«  due to unfavourably chosen DFT parameters.  Again,  we refer to the learning video  $($in German language$)$ 
    »Fehlermöglichkeiten bei Anwendung der DFT«   ⇒   "Possible errors when using the DFT".

$\text{Example 2:}$  The graph shows the DFT result for the same  $x(t)$  and  $X(f)$  as well as the same  $N = 16$  as in  $\text{Example 1}$,  but now with finer sampling in the time domain by a factor of  $2$   ⇒   $T_{\rm A}/T = 0.125$

Truncation error for a DFT with  $N = 16$;     ${\rm MQF}$:   Mean square error

The comparison with  $\text{Example 1}$  shows:

  • The spacing of the frequency samples increases from  $f_{\rm A} \cdot T = 0.25$  to  $f_{\rm A} \cdot T = 0.5$ .
  • At the same time,  $T_{\rm P}/T$  decreases from  $4$  to  $2$.
  • With this,  only the signal components in the range  $\vert t \vert < T$  are now captured by the DFT.



⇒   With these parameters,  a  »truncation error« or  »termination error« arises,  by which the mean square error  is significantly increased from  $\rm MQF= 10^{-12}$  to  $\rm MQF= 4 \cdot 10^{-5}$.


DFT falsification due to sampling – Aliasing error


An unsuitable sampling of the time function  $x(t)$  can also significantly falsify the DFT result.  This so-called  »aliasing error«  can be explained as follows:

  • Sampling  $x(t)$  at a distance  $T_{\rm A}$  causes a periodic continuation of the spectrum at multiples of the periodization frequency  $f_{\rm P} = 1/T_{\rm A}$.
  • If  $X(f)$  has spectral components at  $|f| > f_{\rm P}/2$,  the sampling theorem is not fulfilled and overlaps of the shifted frequency components to be added occur.
  • Only with a band-limited signal the aliasing error can be avoided by suitable DFT parameters.  In contrast,  this error is unavoidable with time-limited signals   ⇒   »pulses«,  since time-limited signals cannot be band-limited at the same time.
  • The aliasing error is reduced by finer sampling  $($smaller  $T_{\rm A} = 1/f_{\rm P})$.  This can only be achieved with a constant  $T_{\rm A}$  – in order not to let the truncation error increase – by a larger  $N$  and thus a greater computational effort.


The following  $\text{Example 3}$  shows such an aliasing error due to wrongly chosen DFT parameters:

  • Compared to the  comparison system  according to  $\text{Example 1}$:     $T_{\rm A}$  is too large and  $f_{\rm A}$  is too small dimensioned.
  • The number of interpolation points is in both cases:  $N = 16$.


$\text{Example 3:}$  Let the DFT parameters be  $N = 16$  and  $f_{\rm A} \cdot T= 0.125$. Thus,  we get for the other three DFT parameters:

Aliasing error of a DFT with  $N = 16$;     ${\rm MQF}$:   mean square error
  • $T_{\rm P}/T = 8 \hspace{0.8cm} \text{(Example 1:} \ \ T_{\rm P}/T = 4)$,
  • $f_{\rm P} \cdot T = 2 \hspace{0.75cm} \text{(Example 1:} \ \ f_{\rm P} \cdot T = 4)$,
  • $T_{\rm A}/T = 0.5\hspace{0.45cm} \text{(Example 1:} \ \ T_{\rm A}/T = 0.25)$.


This results in the following consequences:

  1. The truncation error continues to play no role because of  $T_{\rm P} /T = 8$  $($already  $T_{\rm P} /T = 4$  was sufficient$)$.
  2. However,  aliasing now arises,  because the DFT is derived from many Gaussian functions at distance  $f_{\rm P} \cdot T = 2$  $($thin dashed curves in the graph$)$.
  3. The DFT coefficients are falsified differently:   The mean DFT coefficient  $($for  $f = 0)$  is almost correct, while the errors of the DFT coefficients increase significantly towards the edges.
  4. Here,  the DFT coefficient for  $f \cdot T = -1$  is twice as large as it should be,  since the Gaussian function with the center at  $f \cdot T = -2$  gives the same contribution as the Gaussian function around  $f \cdot T = 0$  (see yellow background).


Thus,  here with  $\text{MQF} \approx 2 \cdot 10^{-4}$  an error value four times larger than that caused by the truncation error in  $\text{Example 2}$.

Again,  we refer to the  $($German language$)$  learning video:
   »Fehlermöglichkeiten bei Anwendung der DFT«   ⇒   "Possible errors when using the DFT".


Exercises for the chapter


Exercise 5.3: Mean Square Error

Exercise 5.3Z: Zero-Padding