Difference between revisions of "Aufgaben:Exercise 5.4: Sine Wave Generator"

From LNTwww
 
(21 intermediate revisions by 4 users not shown)
Line 1: Line 1:
  
{{quiz-Header|Buchseite=Stochastische Signaltheorie/Digitale Filter
+
{{quiz-Header|Buchseite=Theory_of_Stochastic_Signals/Digital_Filters
 
}}
 
}}
  
[[File:P_ID622__Sto_A_5_4.png|right|Realisierung eines Sinusgenerators]]
+
[[File:P_ID622__Sto_A_5_4.png|right|frame|Proposed filter structure]]
Die Grafik zeigt ein digitales Filter zweiter Ordnung, das zum Beispiel zur Erzeugung einer zeitdiskreten Sinusfunktion auf einem digitalen Signalprozessor (DSP) geeignet ist:
+
The diagram shows a second-order digital filter suitable for generating a discrete-time sinusoidal function on a digital signal processor  $\rm (DSP)$,  for example:
:$$\left\langle {y_\nu  } \right\rangle  = \left\langle {\, \sin ( {\nu T \omega _0  } )\, }\right\rangle .$$
+
:$$\left\langle \hspace{0.05cm}{y_\nu  }\hspace{0.05cm} \right\rangle  = \left\langle {\, \sin ( {\nu T \cdot \omega _0  } )\, }\right\rangle .$$
*Vorausgesetzt wird, dass die Eingangsfolge $\left\langle {x_\nu  } \right\rangle$ eine (zeitdiskrete) Diracfunktion beschreibt. Damit sind gleichzeitig alle Ausgangswerte $y_\nu$ für Zeiten $\nu\lt 0$ identisch Null.
+
*It is assumed that the input sequence  $\left\langle \hspace{0.05cm} {x_\nu  } \hspace{0.05cm}\right\rangle$  describes a  (discrete-time)  Dirac delta function.  Thus,  all output values  $y_\nu$  are simultaneously identical to zero for times  $\nu\lt 0$. 
*Die insgesamt fünf Filterkoeffizienten ergeben sich aus der [https://de.wikipedia.org/wiki/Z-Transformation <i>z</i>-Transformation]:
+
*The total of five filter coefficients result from the&nbsp; [https://en.wikipedia.org/wiki/Z-transform $Z$-transform]:
:$$z \{ {\sin ( {\nu T \omega _0 } )} \} = \frac{{z \cdot \sin \left( {\omega _0  T} \right)}}{{z^2  - 2 \cdot z \cdot \cos \left( {\omega _0  T} \right) + 1}}.$$
+
:$$Z \{ {\sin ( {\nu T \omega _0 } )} \} = \frac{{z \cdot \sin \left( {\omega _0  T} \right)}}{{z^2  - 2 \cdot z \cdot \cos \left( {\omega _0  T} \right) + 1}}.$$
*Setzt man diese Gleichung durch ein rekursives Filter zweiter Ordnung $(M = 2)$ um, so erhält man die folgenden Filterkoeffizienten:
+
*Substituting this equation by a recursive second order filter&nbsp; $(M = 2)$,&nbsp; we obtain the following filter coefficients:
:$$a_0 = 0,\quad a_1  = \sin \left( {\omega _0  T} \right),\quad a_2  = 0,\\b_1  = 2 \cdot \cos \left( {\omega _0  T} \right),\quad b_2  =  - 1.$$
+
:$$a_0 = 0,\quad a_1  = \sin \left( {\omega _0  T} \right),\quad a_2  = 0, \quad b_1  = 2 \cdot \cos \left( {\omega _0  T} \right),\quad b_2  =  - 1.$$
  
Im Bild ist bereits durch die hellere Umrandung markiert, dass auf die Filterkoeffizienten $a_0$ und $a_2$ verzichtet werden kann.
+
In the diagram it is already marked by the lighter border that the filter coefficients&nbsp; $a_0$&nbsp; and&nbsp; $a_2$&nbsp; can be omitted.
  
''Hinweise:''
+
 
*Die Aufgabe gehört zum  Kapitel [[Stochastische_Signaltheorie/Digitale_Filter|Digitale Filter]] im vorliegenden Buch.
+
 
*Sollte die Eingabe des Zahlenwertes &bdquo;0&rdquo; erforderlich sein, so geben Sie bitte &bdquo;0.&rdquo; ein.
+
 
*Für die Teilaufgaben (1) bis (3) gelte:
+
 
 +
Notes:  
 +
*The exercise belongs to the chapter &nbsp; [[Theory_of_Stochastic_Signals/Digital_Filters|Digital Filters]]&nbsp; in this book.
 +
*The HTML5/JavaScript applet&nbsp; [[Applets:Digital_Filters|"Digital Filters"]]&nbsp; illustrates the subject matter of this chapter.  
 +
*For the subtasks&nbsp; '''(1)'''&nbsp; to&nbsp; '''(3)'''&nbsp; the following apply:
 
:$$a_1  = 0.5,\quad b_1  = \sqrt 3 .$$
 
:$$a_1  = 0.5,\quad b_1  = \sqrt 3 .$$
  
  
===Fragebogen===
+
===Questions===
  
 
<quiz display=simple>
 
<quiz display=simple>
{Es gelte <i>a</i><sub>1</sub> = 0.5 und <i>b</i><sub>1 </sub>= 3<sup>1/2</sup>. Berechnen Sie die Ausgangswerte <i>y<sub>&nu;</sub></i> zu den Zeitpunkten <i>&nu;</i> = 0, <i>&nu;</i> = 1 und <i>&nu;</i> = 2.
+
{Let&nbsp; $a_1  = 0.5$&nbsp; and&nbsp; $b_1  = \sqrt 3 $.&nbsp; Calculate the initial values&nbsp; $y_\nu$&nbsp; at time points&nbsp; $\nu = 0$,&nbsp; $\nu = 1$&nbsp; and&nbsp; $\nu = 2$.
 
|type="{}"}
 
|type="{}"}
$y_0$ = { 0 3% }
+
$y_0 \ = \ $ { 0. }
$y_1$ = { 0.5 3% }
+
$y_1 \ = \  $ { 0.5 3% }
$y_2$ = { 0.866 3% }
+
$y_2 \ = \  $ { 0.866 3% }
  
  
{Wie lautet der Ausgangswert <i>y<sub>&nu;</sub></i> für <i>&nu;</i> &#8805; 2 allgemein? Berechnen Sie die Werte <i>y</i><sub>3</sub>, ... , <i>y</i><sub>7</sub> und geben Sie zur Kontrolle <i>y</i><sub>7</sub> ein.
+
{What is the initial value &nbsp;$y_\nu$&nbsp; for &nbsp;$\nu \ge 2$&nbsp; in general?&nbsp; Calculate the values &nbsp;$y_3$, ... , $y_7$&nbsp; and enter &nbsp;$y_7$&nbsp; as a check.
 
|type="{}"}
 
|type="{}"}
$y_7$ = - { 0.5 3% }
+
$y_7 \ =  \ $ { -0.515--0.485 }
  
  
{Wie viele Stützstellen (<i>T</i><sub>0</sub>/<i>T</i>) stellen eine Periodendauer (<i>T</i><sub>0</sub>) dar?
+
{How many grid points&nbsp; $(T_0/T)$&nbsp; represent a period&nbsp; $(T_0)$?&nbsp;
 
|type="{}"}
 
|type="{}"}
$T_0/T$ = { 12 3% }
+
$T_0/T\ =  \ $ { 12 3% }
  
  
{Es gelte nun <i>T</i> = 1 &mu;s. Wie müssen die Koeffizienten <i>a</i><sub>1</sub> und <i>b</i><sub>1</sub> gewählt werden, damit eine 10 kHz&ndash;Sinusschwingung erzeugt wird?
+
{Now&nbsp; $T = 1 \hspace{0.05cm} \rm &micro; s$&nbsp; is valid.&nbsp; How must the coefficients&nbsp; $a_1$&nbsp; and&nbsp; $b_1$&nbsp; be selected so that a&nbsp; $\text{10 kHz}$ sine wave is generated?
 
|type="{}"}
 
|type="{}"}
$a_1$ = { 0.062 3% }
+
$a_1 \ =  \ $ { 0.062 3% }
$b_1$ = { 1.996 3% }
+
$b_1 \ =  \ $ { 1.996 3% }
  
  
Line 50: Line 54:
 
</quiz>
 
</quiz>
  
===Musterlösung===
+
===Solution===
 
{{ML-Kopf}}
 
{{ML-Kopf}}
:<b>1.</b>&nbsp;&nbsp;Die &bdquo;1&rdquo; am Eingang wirkt sich am Ausgang erst zum Zeitpunkt <i>&nu;</i> = 1 aus (wegen <i>a</i><sub>0</sub> = 0):
+
'''(1)'''&nbsp; The&nbsp; "$1$"&nbsp; at the input affects&nbsp; $($because of&nbsp; $a_0= 0)$&nbsp; at the output only at the time&nbsp; $\nu = 1$:&nbsp;
 
:$$y_0  \hspace{0.15cm} \underline{= 0},\quad y_1  \hspace{0.15cm} \underline{ = 0.5}.$$
 
:$$y_0  \hspace{0.15cm} \underline{= 0},\quad y_1  \hspace{0.15cm} \underline{ = 0.5}.$$
  
:Bei <i>&nu;</i> = 2 wird auch der rekursive Teil des Filters wirksam:
+
*At&nbsp; $\nu = 2$,&nbsp; the recursive part of the filter also takes effect:
 
:$$y_2  = b_1  \cdot y_1  - y_0  = {\sqrt 3 }/{2} \hspace{0.15cm} \underline{ \approx 0.866}.$$
 
:$$y_2  = b_1  \cdot y_1  - y_0  = {\sqrt 3 }/{2} \hspace{0.15cm} \underline{ \approx 0.866}.$$
  
:<b>2.</b>&nbsp;&nbsp; Für <i>&nu;</i> &#8805; 2 ist das Filter rein rekursiv:
+
 
 +
 
 +
'''(2)'''&nbsp; For&nbsp; $\nu \ge 2$, &nbsp; the filter is purely recursive:
 
:$$y_\nu  = b_1  \cdot y_{\nu  - 1}  - y_{\nu  - 2} .$$
 
:$$y_\nu  = b_1  \cdot y_{\nu  - 1}  - y_{\nu  - 2} .$$
  
:Insbesondere erhält man
+
*In particular,&nbsp; one obtains
 
:$$y_3  = \sqrt 3  \cdot y_2  - y_1  = \sqrt 3  \cdot {\sqrt 3 }/{2} - {1}/{2} = 1;$$
 
:$$y_3  = \sqrt 3  \cdot y_2  - y_1  = \sqrt 3  \cdot {\sqrt 3 }/{2} - {1}/{2} = 1;$$
 
:$$y_4  = \sqrt 3  \cdot y_3  - y_2  = \sqrt 3  \cdot 1 - {\sqrt 3 }/{2} = {\sqrt 3 }/{2};$$
 
:$$y_4  = \sqrt 3  \cdot y_3  - y_2  = \sqrt 3  \cdot 1 - {\sqrt 3 }/{2} = {\sqrt 3 }/{2};$$
 
:$$y_5  = \sqrt 3  \cdot y_4  - y_3  = \sqrt 3  \cdot {\sqrt 3 }/{2} - 1 = {1}/{2};$$
 
:$$y_5  = \sqrt 3  \cdot y_4  - y_3  = \sqrt 3  \cdot {\sqrt 3 }/{2} - 1 = {1}/{2};$$
 
:$$y_6  = \sqrt 3  \cdot y_5  - y_4  = \sqrt 3  \cdot {1}/{2} - {\sqrt 3 }/{2} = 0;$$
 
:$$y_6  = \sqrt 3  \cdot y_5  - y_4  = \sqrt 3  \cdot {1}/{2} - {\sqrt 3 }/{2} = 0;$$
:$$y_7  = \sqrt 3  \cdot y_6  - y_5  = \sqrt 3  \cdot 0 - {1}/{2}  \hspace{0.15cm} \underline{=  - {1}/{2}}.$$
+
:$$y_7  = \sqrt 3  \cdot y_6  - y_5  = \sqrt 3  \cdot 0 - {1}/{2}  \hspace{0.15cm} \underline{=  - 0.5}.$$
 +
 
 +
 
  
:<b>3.</b>&nbsp;&nbsp; Durch Fortsetzung des rekursiven Algorithmuses aus (b) erhält man für große <i>&nu;</i>-Werte:
+
'''(3)'''&nbsp; By continuing the recursive algorithm of subtask&nbsp; '''(2)''',&nbsp; we obtain for large&nbsp; $\nu$&ndash;values: &nbsp;
 
:$$y_\nu  = y_{\nu  - 12} .$$
 
:$$y_\nu  = y_{\nu  - 12} .$$
 +
*From this follows&nbsp; $T_0/T\hspace{0.15cm} \underline{= 12}$.&nbsp; The same result is obtained by the following considerations:
 +
:$$a_1  = \sin \left( {\omega _0  \cdot T} \right) = \sin \left( {2{\rm{\pi }}\cdot{T}/{T_0 }} \right)\mathop  = \limits^! {1}/{2} = \sin \left( {{{\rm{\pi }}}/{6}} \right) \;\;{\rm \Rightarrow} \;\;{2T}/{T_0 } = {1}/{6}\quad  \Rightarrow \;\;{T_0 }/{T} = 12.$$
 +
 +
*Checking the coefficient&nbsp; $b_1$&nbsp; confirms the calculation:
 +
:$$b_1  = 2 \cdot \cos \left( {{{\rm{\pi }}}/{6}} \right) = 2 \cdot {\sqrt 3 }/{2} = \sqrt 3 .$$
  
:Daraus folgt <i>T</i><sub>0</sub>/<i>T</i> <u>= 12</u>. Zum gleichen Ergebnis kommt man durch folgende Überlegungen:
 
:$$a_1  = \sin \left( {\omega _0  \cdot T} \right) = \sin \left( {2{\rm{\pi }}\cdot{T}/{T_0 }} \right)\mathop  = \limits^! {1}/{2} = \sin \left( {{{\rm{\pi }}}/{6}} \right).$$
 
:$${\rm \Rightarrow} \;\;{2T}/{T_0 } = {1}/{6}\quad  \Rightarrow \;\;{T_0 }/{T} = 12.$$
 
  
:Die Überprüfung des Koeffizienten <i>b</i><sub>1</sub> bestätigt die Rechnung:
 
:$$b_1  = 2 \cdot \cos \left( {{{\rm{\pi }}}/{6}} \right) = 2 \cdot c{\sqrt 3 }/{2} = \sqrt 3 .$$
 
  
:<b>4.</b>&nbsp;&nbsp;Aus <i>f</i><sub>0</sub> = 10 kHz folgt <i>T</i><sub>0</sub> = 100 &mu;s bzw. <i>T</i><sub>0</sub>/<i>T</i> = 100. Damit ergibt sich:
+
'''(4)'''&nbsp; From &nbsp;$f_0 = 10 \hspace{0.15cm} \rm kHz$&nbsp; follows &nbsp;$T_0 = 100 \hspace{0.05cm} \rm &micro; s$&nbsp; or &nbsp;$T_0/T = 100$&nbsp;. This gives:
 
:$$a_1  = \sin \left( {2{\rm{\pi }}\cdot{T}/{T_0 }} \right) = \sin \left( {3.6^ \circ  } \right) \hspace{0.15cm} \underline{\approx 0.062},$$
 
:$$a_1  = \sin \left( {2{\rm{\pi }}\cdot{T}/{T_0 }} \right) = \sin \left( {3.6^ \circ  } \right) \hspace{0.15cm} \underline{\approx 0.062},$$
 
:$$b_1  = 2 \cdot \cos \left( {2{\rm{\pi }}\cdot{T}/{T_0 }} \right) = 2 \cdot \cos \left( {3.6^ \circ  } \right) \hspace{0.15cm} \underline{\approx 1.996}.$$
 
:$$b_1  = 2 \cdot \cos \left( {2{\rm{\pi }}\cdot{T}/{T_0 }} \right) = 2 \cdot \cos \left( {3.6^ \circ  } \right) \hspace{0.15cm} \underline{\approx 1.996}.$$
Line 85: Line 93:
  
  
[[Category:Aufgaben zu Stochastische Signaltheorie|^5.2 Digitale Filter^]]
+
[[Category:Theory of Stochastic Signals: Exercises|^5.2 Digital Filters^]]

Latest revision as of 19:53, 10 February 2022

Proposed filter structure

The diagram shows a second-order digital filter suitable for generating a discrete-time sinusoidal function on a digital signal processor  $\rm (DSP)$,  for example:

$$\left\langle \hspace{0.05cm}{y_\nu }\hspace{0.05cm} \right\rangle = \left\langle {\, \sin ( {\nu T \cdot \omega _0 } )\, }\right\rangle .$$
  • It is assumed that the input sequence  $\left\langle \hspace{0.05cm} {x_\nu } \hspace{0.05cm}\right\rangle$  describes a  (discrete-time)  Dirac delta function.  Thus,  all output values  $y_\nu$  are simultaneously identical to zero for times  $\nu\lt 0$. 
  • The total of five filter coefficients result from the  $Z$-transform:
$$Z \{ {\sin ( {\nu T \omega _0 } )} \} = \frac{{z \cdot \sin \left( {\omega _0 T} \right)}}{{z^2 - 2 \cdot z \cdot \cos \left( {\omega _0 T} \right) + 1}}.$$
  • Substituting this equation by a recursive second order filter  $(M = 2)$,  we obtain the following filter coefficients:
$$a_0 = 0,\quad a_1 = \sin \left( {\omega _0 T} \right),\quad a_2 = 0, \quad b_1 = 2 \cdot \cos \left( {\omega _0 T} \right),\quad b_2 = - 1.$$

In the diagram it is already marked by the lighter border that the filter coefficients  $a_0$  and  $a_2$  can be omitted.



Notes:

  • The exercise belongs to the chapter   Digital Filters  in this book.
  • The HTML5/JavaScript applet  "Digital Filters"  illustrates the subject matter of this chapter.
  • For the subtasks  (1)  to  (3)  the following apply:
$$a_1 = 0.5,\quad b_1 = \sqrt 3 .$$


Questions

1

Let  $a_1 = 0.5$  and  $b_1 = \sqrt 3 $.  Calculate the initial values  $y_\nu$  at time points  $\nu = 0$,  $\nu = 1$  and  $\nu = 2$.

$y_0 \ = \ $

$y_1 \ = \ $

$y_2 \ = \ $

2

What is the initial value  $y_\nu$  for  $\nu \ge 2$  in general?  Calculate the values  $y_3$, ... , $y_7$  and enter  $y_7$  as a check.

$y_7 \ = \ $

3

How many grid points  $(T_0/T)$  represent a period  $(T_0)$? 

$T_0/T\ = \ $

4

Now  $T = 1 \hspace{0.05cm} \rm µ s$  is valid.  How must the coefficients  $a_1$  and  $b_1$  be selected so that a  $\text{10 kHz}$ sine wave is generated?

$a_1 \ = \ $

$b_1 \ = \ $


Solution

(1)  The  "$1$"  at the input affects  $($because of  $a_0= 0)$  at the output only at the time  $\nu = 1$: 

$$y_0 \hspace{0.15cm} \underline{= 0},\quad y_1 \hspace{0.15cm} \underline{ = 0.5}.$$
  • At  $\nu = 2$,  the recursive part of the filter also takes effect:
$$y_2 = b_1 \cdot y_1 - y_0 = {\sqrt 3 }/{2} \hspace{0.15cm} \underline{ \approx 0.866}.$$


(2)  For  $\nu \ge 2$,   the filter is purely recursive:

$$y_\nu = b_1 \cdot y_{\nu - 1} - y_{\nu - 2} .$$
  • In particular,  one obtains
$$y_3 = \sqrt 3 \cdot y_2 - y_1 = \sqrt 3 \cdot {\sqrt 3 }/{2} - {1}/{2} = 1;$$
$$y_4 = \sqrt 3 \cdot y_3 - y_2 = \sqrt 3 \cdot 1 - {\sqrt 3 }/{2} = {\sqrt 3 }/{2};$$
$$y_5 = \sqrt 3 \cdot y_4 - y_3 = \sqrt 3 \cdot {\sqrt 3 }/{2} - 1 = {1}/{2};$$
$$y_6 = \sqrt 3 \cdot y_5 - y_4 = \sqrt 3 \cdot {1}/{2} - {\sqrt 3 }/{2} = 0;$$
$$y_7 = \sqrt 3 \cdot y_6 - y_5 = \sqrt 3 \cdot 0 - {1}/{2} \hspace{0.15cm} \underline{= - 0.5}.$$


(3)  By continuing the recursive algorithm of subtask  (2),  we obtain for large  $\nu$–values:  

$$y_\nu = y_{\nu - 12} .$$
  • From this follows  $T_0/T\hspace{0.15cm} \underline{= 12}$.  The same result is obtained by the following considerations:
$$a_1 = \sin \left( {\omega _0 \cdot T} \right) = \sin \left( {2{\rm{\pi }}\cdot{T}/{T_0 }} \right)\mathop = \limits^! {1}/{2} = \sin \left( {{{\rm{\pi }}}/{6}} \right) \;\;{\rm \Rightarrow} \;\;{2T}/{T_0 } = {1}/{6}\quad \Rightarrow \;\;{T_0 }/{T} = 12.$$
  • Checking the coefficient  $b_1$  confirms the calculation:
$$b_1 = 2 \cdot \cos \left( {{{\rm{\pi }}}/{6}} \right) = 2 \cdot {\sqrt 3 }/{2} = \sqrt 3 .$$


(4)  From  $f_0 = 10 \hspace{0.15cm} \rm kHz$  follows  $T_0 = 100 \hspace{0.05cm} \rm µ s$  or  $T_0/T = 100$ . This gives:

$$a_1 = \sin \left( {2{\rm{\pi }}\cdot{T}/{T_0 }} \right) = \sin \left( {3.6^ \circ } \right) \hspace{0.15cm} \underline{\approx 0.062},$$
$$b_1 = 2 \cdot \cos \left( {2{\rm{\pi }}\cdot{T}/{T_0 }} \right) = 2 \cdot \cos \left( {3.6^ \circ } \right) \hspace{0.15cm} \underline{\approx 1.996}.$$