Difference between revisions of "Aufgaben:Exercise 5.3Z: Zero-Padding"

From LNTwww
m (Text replacement - "analyse" to "analyze")
 
(25 intermediate revisions by 5 users not shown)
Line 1: Line 1:
  
{{quiz-Header|Buchseite=Signaldarstellung/Fehlermöglichkeiten bei Anwendung der DFT
+
{{quiz-Header|Buchseite=Signal_Representation/Possible_Errors_When_Using_DFT
 
}}
 
}}
  
[[File:P_ID1146__Sig_Z_5_3_neu.png|right|Zero-Padding bei DFT-Anwendung]]
+
[[File:P_ID1146__Sig_Z_5_3_neu.png|right|frame|$\rm MQF$ values as a function <br>of&nbsp; $T_{\rm A} /T$&nbsp; and&nbsp; $N$]]
Wir betrachten die DFT eines Rechteckimpulses $x(t)$ der Höhe $1$ und der Dauer $T$. Damit hat die Spektralfunktion $X(f)$ einen $\sin(f)/f$–förmigen Verlauf.
+
We consider the DFT of a rectangular pulse&nbsp; $x(t)$&nbsp; of height&nbsp; $A =1$&nbsp; and duration&nbsp; $T$.&nbsp; Thus the spectral function&nbsp; $X(f)$&nbsp; has a&nbsp; $\sin(f)/f$–shaped course.
  
Für diesen Sonderfall soll der Einfluss des DFT–Parameters $N$ analysiert werden, wobei der Stützstellenabstand im Zeitbereich stets $T_{\rm A} = 0.01T$ bzw. $T_{\rm A} = 0.05T$ betragen soll.
+
For this special case the influence of the DFT parameter&nbsp; $N$&nbsp; is to be analyzed, whereby the interpolation point distance in the time domain should always be&nbsp; $T_{\rm A} = 0.01T$&nbsp; or&nbsp; $T_{\rm A} = 0.05T$.
 +
 
 +
The resulting values for the "mean square error"&nbsp; $\rm (MSE)$&nbsp; of the grid values in the frequency domain are given opposite for different values of &nbsp; $N$.&nbsp; Here, we use instead of&nbsp; $\rm MSE$&nbsp; the designation&nbsp; $\rm MQF$ &nbsp; &rArr; &nbsp; (German:&nbsp; "Mittlerer Quadratischer Fehler"):
  
Nebenstehend sind für unterschiedliche Werte von $N$ die sich ergebenden Werte für den ''mittleren quadratischen Fehler'' (MQF) der Stützwerte im Frequenzbereich angegeben:
 
 
:$${\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|X(\mu \cdot f_{\rm A})-\frac{D(\mu)}{f_{\rm A}}\right|^2 \hspace{0.05cm}.$$
Für $T_A/T = 0.01$ sind somit stets $101$ der DFT–Koeffizienten $d(ν)$ von 0 verschieden.
+
Thus, for&nbsp; $T_{\rm A}/T = 0.01$&nbsp;,&nbsp; $101$&nbsp; of the DFT coefficients&nbsp; $d(ν)$&nbsp; are always different from zero.
 +
 
 +
:* Of these, &nbsp; $99$&nbsp;  have the value&nbsp; $1$&nbsp; and the two marginal coefficients are each equal to&nbsp; $0.5$.
 +
 
 +
:* If&nbsp; $N$&nbsp; is increased, the DFT coefficient field is filled with zeros.
 +
 
 +
:*This is then referred to as&nbsp; $\text{zero padding}$.
 +
 
 +
 
  
:* Davon besitzen $99$ den Wert $1$ und die beiden Randkoeffizienten sind jeweils gleich $0.5$.
 
  
:* Vergrößert man $N$, so wird das DFT–Koeffizientenfeld mit Nullen aufgefüllt. Man spricht von ''„Zero–Padding”''.
 
  
''Hinweise:''
 
*Die Aufgabe gehört zum  Kapitel [[Signaldarstellung/Fehlermöglichkeiten_bei_Anwendung_der_DFT|Fehlermöglichkeiten bei Anwendung der DFT]].
 
*Sollte die Eingabe des Zahlenwertes &bdquo;0&rdquo; erforderlich sein, so geben Sie bitte &bdquo;0.&rdquo; ein.
 
*Die Theorie zu diesem Kapitel ist auch im folgenden Lernvideo zusammengefasst:
 
:[[Fehlermöglichkeiten bei Anwendung der DFT (Dauer 7:26)]]
 
  
 +
''Hints:''
 +
*This task belongs to the chapter&nbsp; [[Signal_Representation/Possible_Errors_When_Using_DFT|Possible errors when using DFT]].
 +
 +
*The theory for this chapter is summarised in the (German language) learning video <br> &nbsp; &nbsp; &nbsp;[[Fehlermöglichkeiten_bei_Anwendung_der_DFT_(Lernvideo)|Fehlermöglichkeiten bei Anwendung der DFT]] &nbsp; &rArr; &nbsp; "Possible errors when using DFT".
  
  
===Fragebogen===
+
 
 +
 
 +
 
 +
 
 +
===Questions===
  
 
<quiz display=simple>
 
<quiz display=simple>
{Welche Aussagen können aus den angegebenen MQF-Werten (gültig für $T_A/T = 0.01$ und $N ≥ 128$) abgeleitet werden?
+
{Which statements can be derived from the given MQF values&nbsp; $($valid for&nbsp; $T_{\rm A}/T = 0.01$&nbsp; and&nbsp; $N ≥ 128)$?
 
|type="[]"}
 
|type="[]"}
+ Der MQF–Wert ist hier nahezu unabhängig von $N$.
+
+ The&nbsp; $\rm MQF$ value here is almost independent of&nbsp; $N$.
- Der MQF–Wert wird durch den Abbruchfehler bestimmt.
+
- The&nbsp; $\rm MQF$ value is determined by the truncation error.
+ Der MQF–Wert wird durch den Aliasingfehler bestimmt.
+
+ The&nbsp; $\rm MQF$ value is determined by the aliasing error.
  
  
{Wie groß ist der Abstand $f_A$ benachbarter Abtastwerte im Frequenzbereich für $N = 128$ und $N = 512$?
+
{Let&nbsp; $T_{\rm A}/T = 0.01$.&nbsp; What is the distance&nbsp; $f_{\rm A}$&nbsp; of adjacent samples in the frequency domain for&nbsp; $N = 128$&nbsp; and&nbsp; $N = 512$?
 
|type="{}"}
 
|type="{}"}
$T_A/T = 0.01,\ N = 128:\ \  f_A \cdot T $ = { 0.781 3% }
+
$N = 128$: &nbsp; &nbsp;  $f_{\rm A} \cdot T \ = \ $   { 0.781 3% }
$N = 512:\ \  f_A \cdot T$ = { 0.196 3% }
+
$N = 512$: &nbsp; &nbsp;  $f_{\rm A} \cdot T \ = \ $ { 0.196 3% }
  
  
{Was sagt das Produkt MQF $\cdot f_A$ hinsichtlich der DFT–Qualität aus?
+
{What does the product&nbsp; $\text{MQF} \cdot f_{\rm A}$&nbsp; indicate in terms of DFT quality?
 
|type="[]"}
 
|type="[]"}
+ Dieses berücksichtigt Genauigkeit und Dichte der DFT–Werte.
+
+ The product&nbsp; $\text{MQF} \cdot f_{\rm A}$&nbsp; considers the accuracy and density of the DFT values.
- MQF $\cdot f_A$ sollte möglichst groß sein.
+
- The product&nbsp; $\text{MQF} \cdot f_{\rm A}$&nbsp; should be as large as possible.
  
 
+
{&nbsp; $N = 128$&nbsp; is now fixed.&nbsp; Which statements apply to the comparison of the DFT results with&nbsp; $T_{\rm A}/T = 0.01$&nbsp; und&nbsp; $T_{\rm A}/T = 0.05$ ?
{Es sei $N$ konstant gleich $128$. Welche Aussagen gelten für den Vergleich der DFT–Ergebnisse mit $T_A/T = 0.01$ und $T_A/T = 0.05$ ?
 
 
|type="[]"}
 
|type="[]"}
+ Mit $T_A/T = 0.05$ erhält man eine feinere Frequenzauflösung.
+
+ With&nbsp; $T_{\rm A}/T = 0.05$&nbsp; you get a finer frequency resolution.
- Mit $T_A/T = 0.05$ ist der MQF–Wert kleiner.
+
- With&nbsp; $T_{\rm A}/T = 0.05$&nbsp; the&nbsp; $\rm MQF$ value is smaller.
- Mit $T_A/T = 0.05$ nimmt der Einfluss des Abbruchfehlers ab.
+
- With&nbsp; $T_{\rm A}/T = 0.05$&nbsp; the influence of the truncation error decreases.
+ Mit $T_A/T = 0.05$ wächst der Einfluss des Aliasingfehlers.
+
+ With&nbsp; $T_{\rm A}/T = 0.05$&nbsp; the influence of the aliasing error increases.
  
  
{Welche Aussagen treffen dagegen für den Vergleich der DFT–Ergebnisse mit $T_A/T = 0.01$ und $T_A/T = 0.05$ bei $N = 64$ zu?
+
{Now&nbsp; $N = 64$.&nbsp; Which statements are true for the comparison of the DFT results with&nbsp; $T_{\rm A}/T = 0.01$&nbsp; und&nbsp; $T_{\rm A}/T = 0.05$&nbsp;?
 
|type="[]"}
 
|type="[]"}
+ Mit $T_A/T = 0.05$ erhält man eine feinere Frequenzauflösung.
+
+ With&nbsp; $T_{\rm A}/T = 0.05$&nbsp; you get a finer frequency resolution.
+ Mit $T_A/T = 0.05$ ist der MQF–Wert kleiner.
+
+ With&nbsp; $T_{\rm A}/T = 0.05$&nbsp; the&nbsp; $\rm MQF$ value is smaller.
+ Mit $T_A/T = 0.05$ nimmt der Einfluss des Abbruchfehlers ab.
+
+ With&nbsp; $T_{\rm A}/T = 0.05$&nbsp; the influence of the truncation error decreases.
+ Mit $T_A/T = 0.05$ wächst der Einfluss des Aliasingfehlers.
+
+ With&nbsp; $T_{\rm A}/T = 0.05$&nbsp; the influence of the aliasing error increases.
  
  
Line 66: Line 75:
 
</quiz>
 
</quiz>
  
===Musterlösung===
+
===Solution===
 
{{ML-Kopf}}
 
{{ML-Kopf}}
'''1.'''  Bereits mit $N = 128$ ist $T_P = 1.28 T$, also größer als die Breite des Rechtecks. Somit spielt hier der Abbruchfehler überhaupt keine Rolle. Der MQF–Wert wird allein durch den Aliasingfehler bestimmt. Die Zahlenwerte bestätigen eindeutig, dass MQF (nahezu) unabhängig von $N$ ist. Richtig sind somit die <u>Lösungsvorschläge 1 und 3</u>.
+
'''(1)'''&nbsp; <u>Proposed solutions 1 and 3</u> are correct:
 +
*Already with&nbsp; $N = 128$,&nbsp; $T_{\rm P} = 1.28 \cdot T$, i.e. larger than the width of the rectangle.
 +
*Thus the truncation error plays no role at all here.
 +
*The&nbsp; $\rm MQF$ value is determined solely by the aliasing error.
 +
*The numerical values clearly confirm that&nbsp; $\rm MQF$&nbsp;  is (almost) independent of&nbsp; $N$.  
 +
 
 +
 
 +
 
 +
'''(2)'''&nbsp;  From&nbsp; $T_{\rm A}/T = 0.01$&nbsp; follows&nbsp; $f_{\rm P} \cdot T = 100$.
 +
*The supporting values of&nbsp; $X(f)$ thus lie in the range&nbsp; $–50 ≤ f \cdot T < +50$.
 +
*For the distance between two samples in the frequency range, &nbsp; $f_{\rm A} = f_{\rm P}/N$ applies. This gives the following results:
 +
:*$N = 128$: &nbsp; $f_{\rm A} \cdot T \; \underline{\approx 0.780}$,
 +
:*$N = 512$: &nbsp; $f_{\rm A} \cdot T \; \underline{\approx 0.195}$.
 +
 
 +
 
 +
 
 +
'''(3)'''&nbsp;  The <u>first statement</u> is correct:
 +
*For&nbsp; $N = 128$&nbsp;, the product is&nbsp; $\text{MQF} \cdot f_{\rm A} \approx 4.7 \cdot 10^{-6}/T$.&nbsp; For&nbsp; $N = 512$&nbsp;, the product is smaller by a factor of about&nbsp; $4$&nbsp;.
 +
*This means that&nbsp;„zero padding” does not achieve greater DFT accuracy, but a finer "resolution" of the frequency range.
 +
*The product&nbsp; $\text{MQF} \cdot f_{\rm A}$&nbsp; takes this fact into account; it should always be as small as possible.  
 +
 
 +
 
  
'''2.''' Aus $T_A/T = 0.01$ folgt $f_P \cdot T = 100$. Die Stützwerte von $X(f)$ liegen im Bereich $–50 ≤ f \cdot T < 50$. Für den Abstand zweier Abtastwerte im Frequenzbereich gilt $f_A = f_P/N$. Daraus ergeben sich folgende Ergebnisse: $f_A \cdot T \approx 0.781$ (für $N = 128$) bzw. $f_A \cdot T \approx 0.196$ (für $N = 512$).
+
'''(4)'''&nbsp;  <u>Proposed solutions 1 and 4</u> are correct:
 +
*Because of&nbsp; $T_{\rm A} \cdot f_{\rm A} \cdot N = 1$&nbsp;, a constant&nbsp; $N$&nbsp; always results in a smaller&nbsp; $f_{\rm A}$&nbsp; value when&nbsp; $T_{\rm A}$&nbsp; is increased.
 +
*From the table on the information page, one can see that the mean square error&nbsp; $\rm (MQF)$&nbsp; is significantly increased&nbsp; $($by a factor of about&nbsp; $400)$.  
 +
*The effect is due to the aliasing error, since the transition from&nbsp; $T_{\rm A}/T = 0.01$&nbsp; auf&nbsp; $T_{\rm A}/T = 0.05$&nbsp; reduces the frequency period by a factor of&nbsp; $5$&nbsp;.  
 +
*The truncation error, on the other hand, continues to play no role with the rectangular pulse as long as&nbsp; $T_{\rm P} = N \cdot T_{\rm A}$&nbsp; is greater than the pulse duration&nbsp; $T$.  
  
'''3.'''  Für $N = 128$ ergibt sich für das Produkt MQF $\cdot f_A \approx 4.7 \cdot 10^{–6}/T$, für $N = 512$ dagegen ein um den Faktor 4 kleinerer Wert. Durch „Zero–Padding” wird keine größere Genauigkeit der DFT erzielt, dafür aber eine feinere „Auflösung” des Frequenzbereichs. Das Produkt MQF $\cdot f_A$ berücksichtigt diese Tatsache; es sollte stets möglichst klein sein. Richtig ist die <u>erste Aussage</u>.
 
  
'''4.'''  Wegen $T_A \cdot f_A \cdot N = 1$ ergibt sich bei konstantem $N$ immer dann ein kleinerer $f_A$–Wert, wenn man $T_A$ vergrößert. Aus der Tabelle auf der Angabenseite erkennt man, dass damit der mittlere quadratische Fehler MQF signifikant (um den Faktor $400$) vergrößert wird. Dieser Effekt ist auf die Zunahme des Aliasingfehlers zurückzuführen, da durch den Übergang von $T_A/T = 0.01$ auf $T_A/T = 0.05$ die Frequenzperiode um den Faktor $5$ kleiner wird. Dagegen spielt der Abbruchfehler beim Rechteckimpuls weiterhin keine Rolle, solange $T_P = N \cdot T_A$ größer ist als die Impulsdauer $T$. Richtig sind hier die <u>Lösungsvorschläge 1 und 4</u>.
 
  
'''5.'''  <u>Alle Aussagen treffen zu</u>. Mit den Parameterwerten $N = 64$ und $T_A/T = 0.01$ tritt ein extrem großer Abbruchfehler auf. Alle Zeitkoeffizienten sind hier $1$, so dass die DFT fälschlicherweise ein Gleichsignal anstelle der Rechteckfunktion interpretiert.
+
'''(5)'''&nbsp; <u>All statements are true</u>:
 +
*With the parameter values&nbsp; $N = 64$&nbsp; and&nbsp; $T_{\rm A}/T = 0.01$&nbsp;, an extremely large truncation error occurs.
 +
*All time coefficients are&nbsp; $1$, so the DFT incorrectly interprets a DC signal instead of the rectangular function.
 
{{ML-Fuß}}
 
{{ML-Fuß}}
  
  
 
__NOEDITSECTION__
 
__NOEDITSECTION__
[[Category:Aufgaben zu Signaldarstellung|^5. Zeit- und frequenzdisktrete Signaldarstellung^]]
+
[[Category:Signal Representation: Exercises|^5.3 Possible DFT Errors^]]

Latest revision as of 13:47, 22 September 2021

$\rm MQF$ values as a function
of  $T_{\rm A} /T$  and  $N$

We consider the DFT of a rectangular pulse  $x(t)$  of height  $A =1$  and duration  $T$.  Thus the spectral function  $X(f)$  has a  $\sin(f)/f$–shaped course.

For this special case the influence of the DFT parameter  $N$  is to be analyzed, whereby the interpolation point distance in the time domain should always be  $T_{\rm A} = 0.01T$  or  $T_{\rm A} = 0.05T$.

The resulting values for the "mean square error"  $\rm (MSE)$  of the grid values in the frequency domain are given opposite for different values of   $N$.  Here, we use instead of  $\rm MSE$  the designation  $\rm MQF$   ⇒   (German:  "Mittlerer Quadratischer Fehler"):

$${\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}.$$

Thus, for  $T_{\rm A}/T = 0.01$ ,  $101$  of the DFT coefficients  $d(ν)$  are always different from zero.

  • Of these,   $99$  have the value  $1$  and the two marginal coefficients are each equal to  $0.5$.
  • If  $N$  is increased, the DFT coefficient field is filled with zeros.
  • This is then referred to as  $\text{zero padding}$.




Hints:




Questions

1

Which statements can be derived from the given MQF values  $($valid for  $T_{\rm A}/T = 0.01$  and  $N ≥ 128)$?

The  $\rm MQF$ value here is almost independent of  $N$.
The  $\rm MQF$ value is determined by the truncation error.
The  $\rm MQF$ value is determined by the aliasing error.

2

Let  $T_{\rm A}/T = 0.01$.  What is the distance  $f_{\rm A}$  of adjacent samples in the frequency domain for  $N = 128$  and  $N = 512$?

$N = 128$:     $f_{\rm A} \cdot T \ = \ $

$N = 512$:     $f_{\rm A} \cdot T \ = \ $

3

What does the product  $\text{MQF} \cdot f_{\rm A}$  indicate in terms of DFT quality?

The product  $\text{MQF} \cdot f_{\rm A}$  considers the accuracy and density of the DFT values.
The product  $\text{MQF} \cdot f_{\rm A}$  should be as large as possible.

4

  $N = 128$  is now fixed.  Which statements apply to the comparison of the DFT results with  $T_{\rm A}/T = 0.01$  und  $T_{\rm A}/T = 0.05$ ?

With  $T_{\rm A}/T = 0.05$  you get a finer frequency resolution.
With  $T_{\rm A}/T = 0.05$  the  $\rm MQF$ value is smaller.
With  $T_{\rm A}/T = 0.05$  the influence of the truncation error decreases.
With  $T_{\rm A}/T = 0.05$  the influence of the aliasing error increases.

5

Now  $N = 64$.  Which statements are true for the comparison of the DFT results with  $T_{\rm A}/T = 0.01$  und  $T_{\rm A}/T = 0.05$ ?

With  $T_{\rm A}/T = 0.05$  you get a finer frequency resolution.
With  $T_{\rm A}/T = 0.05$  the  $\rm MQF$ value is smaller.
With  $T_{\rm A}/T = 0.05$  the influence of the truncation error decreases.
With  $T_{\rm A}/T = 0.05$  the influence of the aliasing error increases.


Solution

(1)  Proposed solutions 1 and 3 are correct:

  • Already with  $N = 128$,  $T_{\rm P} = 1.28 \cdot T$, i.e. larger than the width of the rectangle.
  • Thus the truncation error plays no role at all here.
  • The  $\rm MQF$ value is determined solely by the aliasing error.
  • The numerical values clearly confirm that  $\rm MQF$  is (almost) independent of  $N$.


(2)  From  $T_{\rm A}/T = 0.01$  follows  $f_{\rm P} \cdot T = 100$.

  • The supporting values of  $X(f)$ thus lie in the range  $–50 ≤ f \cdot T < +50$.
  • For the distance between two samples in the frequency range,   $f_{\rm A} = f_{\rm P}/N$ applies. This gives the following results:
  • $N = 128$:   $f_{\rm A} \cdot T \; \underline{\approx 0.780}$,
  • $N = 512$:   $f_{\rm A} \cdot T \; \underline{\approx 0.195}$.


(3)  The first statement is correct:

  • For  $N = 128$ , the product is  $\text{MQF} \cdot f_{\rm A} \approx 4.7 \cdot 10^{-6}/T$.  For  $N = 512$ , the product is smaller by a factor of about  $4$ .
  • This means that „zero padding” does not achieve greater DFT accuracy, but a finer "resolution" of the frequency range.
  • The product  $\text{MQF} \cdot f_{\rm A}$  takes this fact into account; it should always be as small as possible.


(4)  Proposed solutions 1 and 4 are correct:

  • Because of  $T_{\rm A} \cdot f_{\rm A} \cdot N = 1$ , a constant  $N$  always results in a smaller  $f_{\rm A}$  value when  $T_{\rm A}$  is increased.
  • From the table on the information page, one can see that the mean square error  $\rm (MQF)$  is significantly increased  $($by a factor of about  $400)$.
  • The effect is due to the aliasing error, since the transition from  $T_{\rm A}/T = 0.01$  auf  $T_{\rm A}/T = 0.05$  reduces the frequency period by a factor of  $5$ .
  • The truncation error, on the other hand, continues to play no role with the rectangular pulse as long as  $T_{\rm P} = N \cdot T_{\rm A}$  is greater than the pulse duration  $T$.


(5)  All statements are true:

  • With the parameter values  $N = 64$  and  $T_{\rm A}/T = 0.01$ , an extremely large truncation error occurs.
  • All time coefficients are  $1$, so the DFT incorrectly interprets a DC signal instead of the rectangular function.