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= | + | {{quiz-Header|Buchseite=Theory_of_Stochastic_Signals/Digital_Filters |
}} | }} | ||
− | [[File:P_ID622__Sto_A_5_4.png|right| | + | [[File:P_ID622__Sto_A_5_4.png|right|frame|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 {y_\nu } \right\rangle = \left\langle {\, \sin ( {\nu T | + | :$$\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ν are simultaneously identical to zero for times ν<0. |
− | * | + | *The total of five filter coefficients result from the [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}}.$$ |
− | * | + | *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,\ | + | :$$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 a0 and a2 can be omitted. | |
− | + | ||
− | * | + | |
− | * | + | |
− | + | ||
+ | Notes: | ||
+ | *The exercise belongs to the chapter [[Theory_of_Stochastic_Signals/Digital_Filters|Digital Filters]] in this book. | ||
+ | *The HTML5/JavaScript applet [[Applets:Digital_Filters|"Digital Filters"]] illustrates the subject matter of this chapter. | ||
+ | *For the subtasks '''(1)''' to '''(3)''' the following apply: | ||
:a1=0.5,b1=√3. | :a1=0.5,b1=√3. | ||
− | === | + | ===Questions=== |
<quiz display=simple> | <quiz display=simple> | ||
− | { | + | {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$. |
|type="{}"} | |type="{}"} | ||
− | y0 | + | $y_0 \ = \ $ { 0. } |
− | y1 | + | $y_1 \ = \ $ { 0.5 3% } |
− | y2 | + | $y_2 \ = \ $ { 0.866 3% } |
− | { | + | {What is the initial value $y_\nu$ for $\nu \ge 2$ in general? Calculate the values y3, ... , y7 and enter y7 as a check. |
|type="{}"} | |type="{}"} | ||
− | y7 | + | $y_7 \ = \ $ { -0.515--0.485 } |
− | { | + | {How many grid points $(T_0/T) represent a period (T_0)$? |
|type="{}"} | |type="{}"} | ||
− | T0/T | + | $T_0/T\ = \ $ { 12 3% } |
− | { | + | {Now $T = 1 \hspace{0.05cm} \rm µ s$ is valid. How must the coefficients a1 and b1 be selected so that a $\text{10 kHz}$ sine wave is generated? |
|type="{}"} | |type="{}"} | ||
− | a1 | + | $a_1 \ = \ $ { 0.062 3% } |
− | b1 | + | $b_1 \ = \ $ { 1.996 3% } |
Line 50: | Line 54: | ||
</quiz> | </quiz> | ||
− | === | + | ===Solution=== |
{{ML-Kopf}} | {{ML-Kopf}} | ||
− | + | '''(1)''' The "1" at the input affects (because of $a_0= 0) at the output only at the time \nu = 1$: | |
:y0=0_,y1=0.5_. | :y0=0_,y1=0.5_. | ||
− | + | *At $\nu = 2$, the recursive part of the filter also takes effect: | |
:y2=b1⋅y1−y0=√3/2≈0.866_. | :y2=b1⋅y1−y0=√3/2≈0.866_. | ||
− | + | ||
+ | |||
+ | '''(2)''' For $\nu \ge 2$, the filter is purely recursive: | ||
:yν=b1⋅yν−1−yν−2. | :yν=b1⋅yν−1−yν−2. | ||
− | + | *In particular, one obtains | |
:y3=√3⋅y2−y1=√3⋅√3/2−1/2=1; | :y3=√3⋅y2−y1=√3⋅√3/2−1/2=1; | ||
:y4=√3⋅y3−y2=√3⋅1−√3/2=√3/2; | :y4=√3⋅y3−y2=√3⋅1−√3/2=√3/2; | ||
:y5=√3⋅y4−y3=√3⋅√3/2−1=1/2; | :y5=√3⋅y4−y3=√3⋅√3/2−1=1/2; | ||
:y6=√3⋅y5−y4=√3⋅1/2−√3/2=0; | :y6=√3⋅y5−y4=√3⋅1/2−√3/2=0; | ||
− | :$$y_7 = \sqrt 3 \cdot y_6 - y_5 = \sqrt 3 \cdot 0 - {1}/{2} \hspace{0.15cm} \underline{= - | + | :$$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ν=yν−12. | :yν=yν−12. | ||
+ | *From this follows T0/T=12_. The same result is obtained by the following considerations: | ||
+ | :a1=sin(ω0⋅T)=sin(2π⋅T/T0)!=1/2=sin(π/6)⇒2T/T0=1/6⇒T0/T=12. | ||
+ | |||
+ | *Checking the coefficient b1 confirms the calculation: | ||
+ | :b1=2⋅cos(π/6)=2⋅√3/2=√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: | |
:a1=sin(2π⋅T/T0)=sin(3.6∘)≈0.062_, | :a1=sin(2π⋅T/T0)=sin(3.6∘)≈0.062_, | ||
:b1=2⋅cos(2π⋅T/T0)=2⋅cos(3.6∘)≈1.996_. | :b1=2⋅cos(2π⋅T/T0)=2⋅cos(3.6∘)≈1.996_. | ||
Line 85: | Line 93: | ||
− | [[Category: | + | [[Category:Theory of Stochastic Signals: Exercises|^5.2 Digital Filters^]] |
Latest revision as of 19:53, 10 February 2022
The diagram shows a second-order digital filter suitable for generating a discrete-time sinusoidal function on a digital signal processor (DSP), for example:
- ⟨yν⟩=⟨sin(νT⋅ω0)⟩.
- It is assumed that the input sequence ⟨xν⟩ describes a (discrete-time) Dirac delta function. Thus, all output values yν are simultaneously identical to zero for times ν<0.
- The total of five filter coefficients result from the Z-transform:
- Z{sin(νTω0)}=z⋅sin(ω0T)z2−2⋅z⋅cos(ω0T)+1.
- Substituting this equation by a recursive second order filter (M=2), we obtain the following filter coefficients:
- a0=0,a1=sin(ω0T),a2=0,b1=2⋅cos(ω0T),b2=−1.
In the diagram it is already marked by the lighter border that the filter coefficients a0 and a2 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:
- a1=0.5,b1=√3.
Questions
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}.