T-61.3010 Digitaalinen signaalinksittely ja suodatus
T-61.3010 Digital Signal Processing and Filtering

============================================================
               RATKAISUJA / SOLUTIONS

                       PART 3
============================================================

------------------------------------------------------------
(21) 1. vlikoe / 1st mid term exam, 6.3.2007
------------------------------------------------------------

Vlikokeen monivalintatehtv 1. /
Multichoice problem 1 in MTE.

Kohdittain / Statement by statement:
  lkm/count N=125: [A/B/C/D/-/Z]	[vast/reply%]:[A/B/C/D/Z%]
 1.1: [B]   --> [3/109/2/4/7/0]		[94%]:[3/92/2/3/0]%
 1.2: [B]   --> [5/108/2/4/6/0]		[95%]:[4/91/2/3/0]%
 1.3: [B]   --> [6/74/8/15/22/0]	[82%]:[6/72/8/15/0]%
 1.4: [D]   --> [9/14/11/66/25/0]	[80%]:[9/14/11/66/0]%
 1.5: [D]   --> [17/6/1/97/4/0]		[97%]:[14/5/1/80/0]%
 1.6: [D]   --> [2/16/17/56/34/0]	[73%]:[2/18/19/62/0]%
 1.7: [ABC] --> [81/9/15/5/15/0]	[88%]:[74/8/14/5/0]%
 1.8: [D]   --> [39/20/9/40/17/0]	[86%]:[36/19/8/37/0]%
 1.9: [C]   --> [4/6/95/11/9/0]		[93%]:[3/5/82/9/0]%
 1.10:[C]   --> [35/1/66/8/15/0]	[88%]:[32/1/60/7/0]%
 1.11:[B]   --> [28/26/19/7/45/0]	[64%]:[35/32/24/9/0]%
 1.12:[B]   --> [3/44/0/11/67/0]	[46%]:[5/76/0/19/0]%
 1.13:[CD]  --> [20/0/13/64/28/0]	[78%]:[21/0/13/66/0]%
 1.14:[BD]  --> [2/13/2/63/45/0]	[64%]:[2/16/2/79/0]%

Some comment:

 1.8. Here omega = 2*pi*200/1000 = 0.4*pi ==> A cannot be true

 1.11. You apply z-transform, partial fraction expansion,
       inverse-z-transform

 1.13. C was correct but also D was approved

Pistekeskiarvo / Mean: N=125: 6.75p / 12p.

Datahistogrammi kokonaispisteist nhtvill
http://www.cis.hut.fi/Opinnot/T-61.3010/VK1_K2007/monivalinta_vk1A_k2007.png 


Vlikokeen tehtv 2 / Problem 2 in MTE

a) Nykyn ei ole mitn syyt olla taltioimatta
   "tydell" 44100 Hz:ll, koska talletuskapasiteetti ei ole ongelma.
   Kuten muussakin digitaalisessa taltioinnissa (kuva, video, ni)
   itse datan kerminen ja editointi kannattaa tehd ilman pakkaamista ja
   vasta mahdollisessa loppukytss pakata pienempn tavumrn.

   Mit Hannu Karpo tekee Kainuun ij haastatellessa?
   Tynt mikrofonin lhelle ij. Puheesta ollaan kiinnostuneita -
   ei taustamelusta. Hienoilla laitteilla voi
   parantaa laatua (Karpon mikiss hassu reuhka vhentmss tuulen osuutta),
   mutta ei niin paljon kuin hyvll nitystilanteella.

   Paljon ehdoteltiin, ett ei puhuttaisi hiritaajuuksilla,
   mutta se on kytnnss mahdotonta. Myskn peittvi taloja tai
   meluaitoja harvoin kvelee jokaiseen turinatilanteeseen apuun.

EN:There is no need to record voice less than 44100 Hz.
   In laptop computers there's enough space for that.
   Consider audio, video or images: 
   You should always record and work with as good quality
   as possible, and only in the end compress if needed.
   Minimum sampling frequencies are in this case are
   probably 7 or 8 kHz. CD quality: 44 kHz, FM stereo: 22 kHz...

b) Sijoitetaan nollakohdat ja navat yhtln ja sievennetn. 
   Huomaa, ett [exp(j w_r) + exp(-j w_r)] = 2 cos(w_r) Eulerin
   kaavan mukaisesti ja taulukosta cos(w_r) = sqrt(2)/2 ~ 0.71

            1 + S{2} z^(-1) + z^(-2)         1 + 1.41 z^(-1) + z^(-2)      
   H(z) = ----------------------------- ~~ -------------------------------  
          1 + cS{2} z^(-1) + c^2 z^(-2)     1 + 1.27 z^(-1) + 0.81 z^(-2)   

   Nollia ja napoja ei tarvitse alkaa laskemaan H(z):sta, koska
   nollat ja navat saadaan suoraan alkuperisest esitysmuodosta:
   Nollat: z1 = exp(j w_r), z2 = exp(-j w_r)  <--- yksikkympyrll 
   Navat:  p1 = c exp(j w_r), p2 = c exp(-j w_r) <--- sispuolella 
   Ovat siis kompleksikonjugaatteja ja samalla kulmalla w_r

   Amplitudivasteessa taajuudella w_r on nollavahvistus.

EN:Write down zeros and poles into the equation. 
   Notice that [exp(j w_r) + exp(-j w_r)] = 2 cos(w_r) using Euler's
   formula and from formula table cos(w_r) = sqrt(2)/2 ~ 0.71

            1 + S{2} z^(-1) + z^(-2)         1 + 1.41 z^(-1) + z^(-2)      
   H(z) = ----------------------------- ~~ -------------------------------  
          1 + cS{2} z^(-1) + c^2 z^(-2)     1 + 1.27 z^(-1) + 0.81 z^(-2)   

   You don't have to start computing zeros and poles from H(z),
   because they were given in a simple polar coordinates:
   Zeros: z1 = exp(j w_r), z2 = exp(-j w_r)  <--- on unit circle
   Poles:  p1 = c exp(j w_r), p2 = c exp(-j w_r) <--- inside 
   They are complex conjugates, and lay at same angle w_r

   The amplitude response at w_r is zero.

c) Napa liikkuu siis origon ja yksikkympyrn vli samalla kulmalla.
   Vaikuttaa tiettyihin "jyrkkyyksiin".

EN:Pole moves between origin and unit circle with the same angle.
   Affects steepness/sharpness of the filter at w_r.

d) Pitisi varmaan "haistella", mill taajuudella hiri on ja
   milloin se on... Monet olivat kytnnllisesti miettineet 
   c:n pienentmist, jolloin vaimentava kaista levenee.


Pistejako: (a) 1.5p, (b) 3.0p, (c) 1.0p, (d) 0.5p

Pistekeskiarvo / Mean N=124: 4.57p / 6p.

Pistehistogrammi N=124:

   | 0 | 0.5 | 1 | 1.5 | 2 | 2.5 | 3 | 3.5 | 4 | 4.5 | 5 | 5.5 | 6 |
   | 0 |  1  | 2 |  6  | 3 |  6  | 9 |  4  | 12| 12  |14 | 18  |37 |


------------------------------------------------------------
(22) 1. vlikoe / 1st mid term exam, 10.3.2007
------------------------------------------------------------

Vlikokeen monivalintatehtv 1. /
Multichoice problem 1 in MTE.


Kohdittain / Statement by statement:
  kok.lkm / total count N=138:
   [A/B/C/D/-/Z]	[vast/replied %]:[A/B/C/D/Z]%
 1.1: [B]    -->  [13/78/12/10/24/1]	[83%]:[11/68/11/9/1]%
 1.2: [D]    -->  [1/2/36/98/1/0]	[99%]:[1/1/26/72/0]%
 1.3: [C]    -->  [8/11/78/22/19/0]	[86%]:[7/9/66/18/0]%
 1.4: [B]    -->  [15/45/11/57/10/0]	[93%]:[12/35/9/45/0]%
 1.5: [D]    -->  [13/11/0/101/13/0]	[91%]:[10/9/0/81/0]%
 1.6: [A]    -->  [51/22/34/4/27/0]	[80%]:[46/20/31/4/0]%
 1.7: [C]    -->  [11/31/78/3/15/0]	[89%]:[9/25/63/2/0]%
 1.8: [AD]   -->  [30/4/53/41/9/1]	[93%]:[23/3/41/32/1]%
 1.9: [BC]   -->  [3/64/61/3/7/0]	[95%]:[2/49/47/2/0]%
 1.10:[B]    -->  [24/58/19/8/29/0]	[79%]:[22/53/17/7/0]%
 1.11:[C]    -->  [mistake]
 1.12:[A]    -->  [50/2/0/10/76/0]	[45%]:[81/3/0/16/0]%
 1.13:[D]    -->  [16/3/6/67/46/0]	[67%]:[17/3/7/73/0]%
 1.14:[BD]   -->  [18/14/14/22/70/0]	[49%]:[26/21/21/32/0]%


Some comment:

 1.4: h[n] = (-2)^n mu[-2-n]
  h[0] = 0, h[-1] = 0, h[-2] = (-2)^(-2) = 0.25,  
  h[-3] = (-2)^(-3) = -0.125, h[-4] = (-2)^(-4) = 0.0625, ...
  --> geometric series, whose sum is finite == STABLE FILTER
  SUM_(i=0)^(oo) 0.25 . (-0.5)^n = 0.25 . (1 / (1 + 0.5)) = 
   (1/4) . (2/3) = 1/6 < oo 
  However, filter is not causal

 1.8: (C) vrin / wrong: T_s > 0.05 ms <==> f_s < 10 kHz
  -- CD quality 44100 Hz

 1.14 piip / beep?
  -- you can try with Matlab:
  (A) and (C) are constants with no oscillation (energy)
  (D) omega = 0.000125 pi, omega = 2pi f/fs --> f = 0.5 Hz,
  which cannot be played / heard.
  However, I have accepted also (D). 
  (C), which is only audible signal, is the choice of the moral winner.

Pistekeskiarvo / Mean: N=138: 6.44p / 12p.

Datahistogrammi kokonaispisteist nhtvill
http://www.cis.hut.fi/Opinnot/T-61.3010/VK1_K2007/monivalinta_vk1B_k2007.png 



Vlikokeen tehtv 2 / Problem 2 in MTE

   H(z) = K . (H1(z) + H2(z))

   In this problem some key concepts:
  - e^(j pi) == -1, e^(j pi n) == (-1)^n ==  {1, -1, 1, -1, ...} 
  - H(z) = H1(z) + H2(z)  <--> h[n] = h1[n] + h2[n],
    that is, no need for partial fraction expansion in (c)

a) Zeros: none (or one in origo) 
   Poles: z - 0.8 = 0, z = 0.8 inside unit circle 

                  ^ 
                 -1- 
                / | \ 
               /  |  \ 
         -----    |   ----- 
   ------         |        ------
                  | 
   ---------------0----------------> w 
   -pi    -pi/2   0      pi/2     pi 

   lowpass with H1(e^jw) = 1 / (1 - 0.8 e^(-jw))
                h1[n]    = 0.8^n mu[n]

b) ^ 
   |               
   1             --- 
   |            /   \ 
   |           /     \ 
   |     -----        ----- 
   |-----                  ------
   |                
   0-------------------------------> w 
   0     pi/2    pi      3pi/2   2pi 

   highpass with H2(e^jw) = 1 / (1 - 0.8 e^(-j(w-pi)))
                          = 1 / (1 - 0.8 e^(-jw)e^(j pi))
                          = 1 / (1 + 0.8 e^(-jw))
                 h2[n]    = (-0.8)^n mu[n]
                          = {_1_, -0.8, 0.64}

c) H(z) = K . (H1(z) + H2(z))
        = K . (2 / [1 - 0.64 z^(-2)])

   Max can be found by computing |H(z)|=1 at omega=0 <==> z=1
     NOT just by CHOOSING K=1/2
   |H(z=1)| = | K . (2 / [1 - 0.64]) | = 1
      => K = 0.18 

   H(z) = 0.36 / [1 - 0.64 z^(-2)]

   Poles omega=0, omega=pi  ==> bandstop

   Impulse response h[n] = K( h1[n] + h2[n] ).
   Because h1[n] and h2[n] are known, you do not have to
   decompose second-order H(z) at all, but add the results
   of (a) and (b):

   h[n] = K (h1[n] + h2[n]) = 
        = K ({_1_, 0.8, 0.64, 0.512,...} + {_1_, -0.8, 0.64, -0.512, ...})
        = K ({_2_, 0, 1.28, 0, ...})
   SUM_k h[2k+1] = 0 + 0 + 0 + ... = 0


Pistejako kohdittain: (a) 3p, (b) 1.5p, (c) 1.5p


Pistekeskiarvo N=138: 3.60p / 6p.

Pistehistogrammi N=138:

   | 0 | 0.5 | 1 | 1.5 | 2 | 2.5 | 3 | 3.5 | 4 | 4.5 | 5 | 5.5 | 6 |
   | 13|  3  | 5 |  8  | 11|  6  | 10|  8  | 9 | 10  |17 | 22  |16 |


------------------------------------------------------------
(23) 2. vlikoe / 2nd mid term exam, 7.5.2007
------------------------------------------------------------

Vlikokeen monivalintatehtv 1. /
Multichoice problem 1 in MTE.


Kohdittain / Statement by statement:
  kok.lkm / total count N=110:
   [A/B/C/D/-/Z]	[vast/replied %]:[A/B/C/D/Z]%
 1.1: - [ABCD]  [15/3/46/28/18/0]	[84%]:[16/3/50/30/0]%
 1.2: - [AC]    [42/2/27/29/10/0]	[91%]:[42/2/27/29/0]%
 1.3: - [B]     [19/56/7/2/26/0]	[76%]:[23/67/8/2/0]%
 1.4: - [D]     [1/11/1/54/43/0]	[61%]:[1/16/1/81/0]%
 1.5: - [C]     [9/8/63/4/26/0]		[76%]:[11/10/75/5/0]%
 1.6: - [D]     [4/4/7/73/22/0]		[80%]:[5/5/8/83/0]%
 1.7: - [C]     [1/28/61/3/17/0]	[85%]:[1/30/66/3/0]%
 1.8: - [B]     [24/10/29/13/34/0]	[69%]:[32/13/38/17/0]%
 1.9: - [A]     [24/2/28/1/55/0]	[50%]:[44/4/51/2/0]%
 1.10:  [C]     [25/7/16/0/62/0]	[44%]:[52/15/33/0/0]%
 1.11:  [C]     [0/1/42/16/51/0]	[54%]:[0/2/71/27/0]%
 1.12:  [C]     [2/0/3/7/98/0]		[11%]:[17/0/25/58/0]%
 1.13:  [B]     [28/27/2/13/40/0]	[64%]:[40/39/3/19/0]%
 1.14:  [A]     [79/1/1/6/23/0]		[79%]:[91/1/1/7/0]%



Muutama huomautus kohteisiin, joissa moodi (yleisin vastaus)
ei ole sama kuin "oikea" vastaus /
Some comment:

- 1.1: Linear-phase filter h[n] = +- h[N-n] or +-h[N-1-n]
       Zero-phase is a "special case" where N=0. 
       However, because only suitable solution (C)
       is zero-phase filter, we have accepted any choice 
       (A)/(B)/(C)/(D)/- to give 1 point 

- 1.2: H(z) = [1 + Az^(-1)] . [1 + Bz^(-1)] 
            = 1 + (A+B) z^(-1) + AB z^(-2) 
       h[n] = {1, A+B, AB} 
   --> h[n] = {1, 2, 1}, A=1, B=1 

- 1.8: H_LP(z) <---> h_LP[n] = 0.75 sinc(0.75 n) 
       H_HP(z) = 1 - H_LP(z) 
       h_HP[n] = delta[n] - h_LP[n] 
       h_HP[0] = delta[0] - h_LP[0] 
               = 1 - 0.75 = 0.25 
- 1.9: shifting H_HP(z) (passband 3pi/4..5pi/4) by pi 

- 1.10: Psi_3[87] = Psi_2[85] - W_4^1 Psi_2[87] 
     = (Psi_1[84] - Psi_1[85]) + j (Psi_1[86] - Psi_1[87]) 
     = -64 - 64j 

- 1.12: Psi_8[0] = (Psi_6[0] + Psi_6[32]) + 
                   (Psi_6[64] + Psi_6[96]) 
                 = SUM_i Psi_1[i] 
                 = SUM_n x[n] = 8128 
- 1.13: 
        ^             
        |             
      1 |             /| 
        |            / | 
        |           /  | 
        |----|----|/   |----|           
        0                  pi

  L=4 
        0                 4pi

  --> aliasing 

        ^ n
    1/4 |   /|\      /|\ 
        |  / | \    / | \ 
        | /  |  \  /  |  \ 
        |/   |   \/   |   \       
        0   pi  2pi  3pi  4pi


Pistekeskiarvo / Mean:  N=110: 4.30p / 12p.

Datahistogrammi kokonaispisteist nhtvill / 
Histogram of total points: 
http://www.cis.hut.fi/Opinnot/T-61.3010/VK2_K2007/monivalinta_vk2A_k2007.png 


Tehtv 2 / Problem 2 


Kohteet:
- suotimen kertoimien kvantisointi
- aritmeettisten operaatioiden jlkeen kvantisointi
- A/D-muunnos

Vaikutuksia:
- suotimen kertoimet: kertoimet muuttuu - navat, nollat
  muuttuvat, suodin saattaa muuttua epstabiiliksi
- 

Mit keinoja vltt:
- virheen takaisinkytkent


Tehtv 3 / Problem 3

3a) Delta omega = 0.1 pi,
    M = 56,
    N = 112

3b) h_ideal[n] = 0.75 sinc(0.75 n)
    h_ideal[-7] = -0.0322
    h_ideal[0] = 0.750
    h_ideal[7] = -0.0322
    h_ideal[2007] = -0.000112    

3c) h_FIR[n] = h_ideal . w[n]
    h_FIR[-7] = -0.0302
    h_FIR[0] = 0.750
    h_FIR[7] = -0.0302
    h_FIR[2007] = 0


Tehtv 4 / Problem 4

4a) h_2[n] = {2, -1, _1_}

4b) zplane([1 -1],1), zplane([2 -1 1], 1)

4c) Stabiilisuus SUM_n |h[n]| < oo,
    Kausaalisuus h[n] = 0, n < 0 

    h_1[n] stab., kaus.
    h_2[n] stab., ei-kaus.
    h[n] stab., kaus.

    Osoita nm! h_1[n]:lle ja h_2[n]:lle!


Tentin monivalintatehtv 5. /
Multichoice problem 5 in final exam.

1 D
2 C
3 D
4 C
5 B
6 C
7 C
8 D
9 B
10 AD
11 D
12 B
13 C
14 A


------------------------------------------------------------
(24) 2. vlikoe / 2nd mid term exam, 15.5.2007
------------------------------------------------------------

Kohdittain / Statement by statement:
  kok.lkm / total count N=112:
   [A/B/C/D/-/Z]	[vast/replied %]:[A/B/C/D/Z]%
 1.1: [ABC]    [66/8/7/5/26/0]	[77%]:[77/9/8/6/0]%
 1.2: [C]    [10/17/49/13/23/0]	[79%]:[11/19/55/15/0]%
 1.3: [A]    [81/5/6/5/15/0]	[87%]:[84/5/6/5/0]%
 1.4: [D]    [17/1/1/71/22/0]	[80%]:[19/1/1/79/0]%
 1.5: [B]    [3/92/3/4/10/0]	[91%]:[3/90/3/4/0]%
 1.6: [B]    [0/78/0/4/30/0]	[73%]:[0/95/0/5/0]%
 1.7: [A]    [72/4/4/0/32/0]	[71%]:[90/5/5/0/0]%
 1.8: [C]    [1/9/61/0/41/0]	[63%]:[1/13/86/0/0]%
 1.9: [C]    [4/14/51/3/40/0]	[64%]:[6/19/71/4/0]%
 1.10: [C]    [25/10/33/4/40/0]	[64%]:[35/14/46/6/0]%
 1.11: [C]   [11/2/19/2/78/0]	[30%]:[32/6/56/6/0]%
 1.12: [B]    [4/54/2/36/16/0]	[86%]:[4/56/2/38/0]%
 1.13: [B]    [7/47/6/4/48/0]	[57%]:[11/73/9/6/0]%
 1.14: [C]    [2/4/88/2/16/0]	[86%]:[2/4/92/2/0]%



Muutama huomautus kohteisiin, joissa moodi (yleisin vastaus)
ei ole sama kuin "oikea" vastaus /
Some comment:

- 1.10: H_LP(z) <---> h_LP[n] = 0.25 sinc(0.25 n) 
        H_HP(z) = 1 - H_LP(z) 
        h_HP[n] = delta[n] - h_LP[n] 
        h_HP[0] = delta[0] - h_LP[0] 
               = 1 - 0.25 = 0.75 
Pistekeskiarvo / Mean:  N=112: 6.65p / 12p.

Datahistogrammi kokonaispisteist nhtvill / 
Histogram of total points: 
http://www.cis.hut.fi/Opinnot/T-61.3010/VK2_K2007/monivalinta_vk2B_k2007.png 


Tentin tehtv 2 / Problem 2 in exam

   Mitra / Lecture slides, Chapter 10, Matlab 

   - FIR filter design
   - cutting signal into smaller parts

   ...


Tentin tehtv 3 / Problem 3 in exam

   H(z) = 0.022 [1 - 1.6 z^(-2) + 0.672 z^(-4)]/
                [1 + 1.6 z^(-2) + 0.672 z^(-4)]

   Kohina voimistuu ~0.5pi taajuuksilla -->
   H_es(z) = 1 + 1 z^(-2) <=> k1=0, k2=1

Tentin tehtv 4 / Problem 4 in exam

   h1[n] = [1 -3 2]    h2[n] symmetrinen, ryhmviive vakio 2.5





Tentin monivalintatehtv 5.
Multichoice problem 5 in exam.

Kohdittain / Statement by statement:
  kok.lkm / total count N=21:
   [A/B/C/D/-/Z]	[vast/replied %]:[A/B/C/D/Z]%
 1.1: [AC]    [7/3/6/1/4/0]	[81%]:[41/18/35/6/0]%
 1.2: [A]    [6/1/0/8/6/0]	[71%]:[40/7/0/53/0]%
 1.3: [C]    [4/2/8/3/4/0]	[81%]:[24/12/47/18/0]%
 1.4: [C]    [0/1/14/4/2/0]	[90%]:[0/5/74/21/0]%
 1.5: [A]    [5/0/2/0/14/0]	[33%]:[71/0/29/0/0]%
 1.6: [C]    [5/2/8/2/4/0]	[81%]:[29/12/47/12/0]%
 1.7: [C]    [3/0/15/1/2/0]	[90%]:[16/0/79/5/0]%
 1.8: [B]    [3/10/1/2/5/0]	[76%]:[19/62/6/12/0]%
 1.9: [B]    [0/9/3/1/8/0]	[62%]:[0/69/23/8/0]%
 1.10: [D]    [0/1/0/8/12/0]	[43%]:[0/11/0/89/0]%
 1.11: [B]    [0/5/3/2/11/0]	[48%]:[0/50/30/20/0]%
 1.12: [B]    [1/8/0/1/11/0]	[48%]:[10/80/0/10/0]%
 1.13: [A]    [10/0/2/0/9/0]	[57%]:[83/0/17/0/0]%
 1.14: [C]    [0/0/12/2/7/0]	[67%]:[0/0/86/14/0]%



Muutama huomautus kohteisiin, joissa moodi (yleisin vastaus)
ei ole sama kuin "oikea" vastaus /
Some comment:

- 5.2:  perustaajuus f_0:n avulla voidaan lausua muut
        sen monikertoina f_5 = 5 f_0

        Kun w_0 = 0.1pi, niin 
        0.2pi = 2 . 0.1pi, 0.4pi = 4 . 0.1pi, 0.5 pi = 5 . 0.1pi

- 5.3:  rettmn pitk impulssivaste <=> IIR-suodin

- 5.6:  korkeiden taajuuksien laskostuminen - 
        eivt katoa (teoriassa)

Pistekeskiarvo / Mean:  N=21: 4.71p / 12p.

Datahistogrammi kokonaispisteist nhtvill / 
Histogram of total points: 
http://www.cis.hut.fi/Opinnot/T-61.3010/VK2_K2007/monivalinta_tenttiB_k2007.png 

