T-61.3010 Digitaalinen signaalinkäsittely ja suodatus
T-61.3010 Digital Signal Processing and Filtering

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

                       PART 5
============================================================

------------------------------------------------------------
(29) 1. välikoe / 1st mid term exam, 7.3.2009
------------------------------------------------------------

Tehtävä 1 / 7.3.2009

Kohdittain / Statement by statement:
  kok.lkm / total count N=41:
 väite: sinun [oikea(t)] --> lkm[A/B/C/D/-/Z] [vastaus%]:[A/B/C/D/Z]%
 statem.: yours [correct] --> count[A/B/C/D/-/Z] [reply%]:[A/B/C/D/Z]%
 1.1: [CD]--> [0/0/12/29/0/0]	[100%]:[0/0/29/71/0]%
 1.2: [C] --> [2/2/34/3/0/0]	[100%]:[5/5/83/7/0]%
 1.3: [D] --> [1/5/2/30/3/0]	[93%]:[3/13/5/79/0]%
 1.4: [B] --> [6/31/2/1/1/0]	[98%]:[15/78/5/2/0]%
 1.5: [C] --> [5/5/23/1/7/0]	[83%]:[15/15/68/3/0]%
 1.6: [A] --> [14/14/0/4/9/0]	[78%]:[44/44/0/12/0]%
 1.7: [C] --> [4/0/33/1/3/0]	[93%]:[11/0/87/3/0]%
 1.8: [A] --> [16/10/6/2/7/0]	[83%]:[47/29/18/6/0]%
 1.9: [D] --> [1/13/2/25/0/0]	[100%]:[2/32/5/61/0]%
 1.10:[D] --> [4/0/0/18/19/0]	[54%]:[18/0/0/82/0]%
 1.11:[A] --> [7/2/0/6/26/0]	[37%]:[47/13/0/40/0]%
 1.12:[D] --> [6/4/6/11/14/0]	[66%]:[22/15/22/41/0]%

Muutamia kommentteja / Some comment:

1.4: (B) y[n] = -0.9 y[n-1] + 0.7 y[n-2] + ... 

1.5: (C) from formula paper: 
     H(z) = K [PROD_i (1 - z_i z^(-1))] / [PROD_i (1 - p_i z^(-1))] 

1.6: (B) was close but (A) better, because zero is not so dominant, 
     and poles at low frequency. Giving +1p for (B) is not fair
     for those not replying anything (for reason or another).

1.8: LTI: only summing, multiplication by constant, delays. 
     Median requires sorting. 

1.9: (B) T < 0.2 ms  <=> f > 5000 Hz. 


Pistekeskiarvo / Mean:  N=41: 5.45 p / 12 p.
Datahistogrammi kokonaispisteistä nähtävillä / 
Histogram of total points: 
http://www.cis.hut.fi/Opinnot/T-61.3010/VK1_K2009/monivalinta_vk1A_k2009.png 


    *** Pisterajat laskevat useita pisteitä (4 p ???) 
        kurssiesitteessä esitetystä. *** 

    Tarkemmat tiedot kun molemmat välikokeet tarkastettu.

    - Monivalintatehtäviä on paljon tenttiaikaan suhteutettuna,
      jos vääriä vastausvaihtoehtoja ei "näe otsalla"
    - Monivalintatehtävästä miinuspisteillä arvostelusta
      tulee hyvin "raju". Pluspisteet osoittavat jo hyvää
      tietämystä, nollapisteet eivät ole tästä välttämättä
      komplementti.
    - VK1A oli hieman liian vaikea, koska erottelukyky ei ollut
      hyvä asteikon +päässä.

Tehtävä 2 / Problem 2 

...

------------------------------------------------------------
(30) 1. välikoe / 1st mid term exam, 13.3.2009
------------------------------------------------------------

Monivalintatehtävä 1
Multichoice Problem 1

Kohdittain / Statement by statement:
  kok.lkm / total count N=75:
 väite: sinun [oikea(t)] --> lkm[A/B/C/D/-/Z] [vastaus%]:[A/B/C/D/Z]%
 statem.: yours [correct] --> count[A/B/C/D/-/Z] [reply%]:[A/B/C/D/Z]%
 1.1: [CD]--> [0/0/13/59/3/0]	[96%]:[0/0/18/82/0]%
 1.2: [D] --> [2/1/4/63/5/0]	[93%]:[3/1/6/90/0]%
 1.3: [D] --> [9/3/4/50/9/0]	[88%]:[14/5/6/76/0]%
 1.4: [B] --> [19/52/1/0/3/0]	[96%]:[26/72/1/0/0]%
 1.5: [D] --> [2/1/10/24/38/0]	[49%]:[5/3/27/65/0]%
 1.6: [C] --> [7/13/29/0/26/0]	[65%]:[14/27/59/0/0]%
 1.7: [A] --> [17/9/0/11/38/0]	[49%]:[46/24/0/30/0]%
 1.8: [A] --> [48/5/7/11/4/0]	[95%]:[68/7/10/15/0]%
 1.9: [C] --> [0/10/45/13/7/0]	[91%]:[0/15/66/19/0]%
 1.10:[C] --> [1/1/23/33/17/0]	[77%]:[2/2/40/57/0]%
 1.11:[C] --> [5/2/30/4/34/0]	[55%]:[12/5/73/10/0]%
 1.12:[A] --> [24/7/4/22/18/0]	[76%]:[42/12/7/39/0]%

Muutamia kommentteja / Some comment:

1.4: (B) y[n] = 0.1 y[n-1] - 0.2 y[n-2] + ... 

1.5: (D) Poles +- 0.9 j => bandpass filter at pi/2 

1.10: (C) [1 1]*[1 1] => [1 2 1], [1 2 1]*[1 1] => [1 3 3 1]...
     binomial coefficients, Pascals triangle [1 6 15 20 15 6 1]

1.12: h[n] is _not_ symmetric, cannot be (D)


Pistekeskiarvo / Mean:  N=75: 4.93 p / 12 p.
Datahistogrammi kokonaispisteistä nähtävillä / 
Histogram of total points: 
http://www.cis.hut.fi/Opinnot/T-61.3010/VK1_K2009/monivalinta_vk1B_k2009.png 

Tehtävä 2 / Problem 2 

...


------------------------------------------------------------
(31) Tentti / 2. välikoe / 2nd mid term exam, 6.5.2009
------------------------------------------------------------

Monivalintatehtävä 1

Kohdittain / Statement by statement:
  kok.lkm / total count N=41:
 väite: sinun [oikea(t)] --> lkm[A/B/C/D/-/Z] [vastaus%]:[A/B/C/D/Z]%:/ok%/ 
 statem.: yours [correct] --> count[A/B/C/D/-/Z] [reply%]:[A/B/C/D/Z]%:/ok%/ 
 1.1:  [C] -> [5/1/29/3/3/0]	[93%]:[13/3/76/8/0]%:/71%/
 1.2:  [B] -> [1/38/1/0/1/0]	[98%]:[2/95/2/0/0]%:/93%/
 1.3:  [A] -> [19/2/3/5/12/0]	[71%]:[66/7/10/17/0]%:/46%/
 1.4:  [A] -> [29/1/3/1/7/0]	[83%]:[85/3/9/3/0]%:/71%/
 1.5:  [B] -> [1/23/1/8/8/0]	[80%]:[3/70/3/24/0]%:/56%/
 1.6:  [C] -> [2/0/23/1/15/0]	[63%]:[8/0/88/4/0]%:/56%/
 1.7:  [B] -> [5/24/4/1/7/0]	[83%]:[15/71/12/3/0]%:/59%/
 1.8:  [C] -> [1/3/32/1/4/0]	[90%]:[3/8/86/3/0]%:/78%/
 1.9:  [D] -> [1/16/0/16/8/0]	[80%]:[3/48/0/48/0]%:/39%/
 1.10: [C] -> [0/0/31/3/7/0]	[83%]:[0/0/91/9/0]%:/76%/
 1.11: [A] -> [12/0/1/3/25/0]	[39%]:[75/0/6/19/0]%:/29%/
 1.12: [C] -> [2/1/17/2/19/0]	[54%]:[9/5/77/9/0]%:/41%/

Muutamia kommentteja / Some comment:

1.1: Use temporary variable W(z) after the summing. 
     (A): wrong: if x[n] went to both R(z) and T(z) without
          any feedback loop, then ok.

1.3: A new, tricky problem. Use z-transform and simplify W(z) out. 
     W(z) = 0.5 X(z) + 0.8 z^-1 W(z) = 0.5 X(z) / [1 - 0.8 z^-1]
     Y(z) = 0.25 z^-1 X(z) - 0.5 z^-1 W(z)
          = 0.25 z^-1 X(z) - 0.5 z^-1 0.5 X(z) / [1 - 0.8 z^-1] = ...
     You can also "easily" (se kuuluisa otsa) 
      draw flow graph with a feedback <=> 
      IIR <=> feedback <=> no linear-phase. Image:
      http://www.cis.hut.fi/Opinnot/T-61.3010/VK2_K2009/vaite_1_3.png 

1.5: (B) Directly, 20*log10(lowlimit/highlimit) 
                 = 20*log10(0.9/1.1) = -1.74 dB 

1.6: Window method: h_FIR[n] = h_ideal[n] . w[n]

1.9: The only "not-clear" statement today if comparing to answers.

     Also due to the nasty (D) option "none of above".

     8 bits is relatively small accuracy. With 8 bits you can have
     only 2^8 = 256 values. If you thing audio signal quantization levels
     then this can be enough for a speech signal. In CD quality there are
     2^16 ~ 65000 levels.

     In Matlab default is "double", see e.g. IEEE 754, 
     "data types and scaling". Low limit is about 2 10^-308, 
     high limit 2 . 10^308 with accuracy 2^-52 ~ 10^-16.

     If you take option (B) as a statement without the context 
     to example of S = 1 - 0.3 ..., then you can assume to be pretty
     close if you assume 8-bit images or audios. 

1.11: (A) |LP| -> peaks w=0.05 and w=0.3; 
       -> |M2| -> peaks w=0.1 and w=0.6; 
       -> |HP| -> peak w=0.6; 
       -> |M2| -> peak w=0.8 (aliased from w=1.2) 

1.12: (C) DTMF-signal "9"


Pistekeskiarvo / Mean:  N=41: 6.16 p / 12 p.
Datahistogrammi kokonaispisteistä nähtävillä / 
Histogram of total points: 
http://www.cis.hut.fi/Opinnot/T-61.3010/VK2_K2009/monivalinta_vk2A_k2009.png 


Tehtävä 2 / Problem 2 

2A: fft([3 -1 -4 2]) --> X[k]={_0_, 7+3j, -2, 7-3j} 

2B: ASR

Problem 3

3a convolution:
3b deconvolution:

Problem 4, 2nd order stable IIR filter

Problem 5, using temporary variables

Problem 6, bilinear transform

Problem 7, quantization

------------------------------------------------------------
(32) Tentti / 2. välikoe / 2nd mid term exam, 13.5.2009
------------------------------------------------------------

Monivalintatehtävä 1.

Kohdittain / Statement by statement:
  kok.lkm / total count N=52:
 väite: sinun [oikea(t)] --> lkm[A/B/C/D/-/Z] [vastaus%]:[A/B/C/D/Z]%:/ok%/ 
 statem.: yours [correct] --> count[A/B/C/D/-/Z] [reply%]:[A/B/C/D/Z]%:/ok%/ 
 1.1: [A] -> [40/1/0/6/5/0]	[90%]:[85/2/0/13/0]%:/77%/
 1.2: [D] -> [0/0/0/49/3/0]	[94%]:[0/0/0/100/0]%:/94%/
 1.3: [C] -> [4/1/36/2/9/0]	[83%]:[9/2/84/5/0]%:/69%/
 1.4: [A] -> [31/1/3/1/16/0]	[69%]:[86/3/8/3/0]%:/60%/
 1.5: [B] -> [1/38/1/1/11/0]	[79%]:[2/93/2/2/0]%:/73%/
 1.6: [B] -> [1/47/2/1/1/0]	[98%]:[2/92/4/2/0]%:/90%/
 1.7: [B] -> [0/32/1/0/19/0]	[63%]:[0/97/3/0/0]%:/62%/
 1.8: [D] -> [1/0/2/32/17/0]	[67%]:[3/0/6/91/0]%:/62%/
 1.9: [D] -> [3/1/1/13/34/0]	[35%]:[17/6/6/72/0]%:/25%/
 1.10:[B] -> [0/24/6/2/20/0]	[62%]:[0/75/19/6/0]%:/46%/
 1.11:[B] -> [7/8/3/5/29/0]	[44%]:[30/35/13/22/0]%:/15%/
 1.12:[D] -> [6/3/0/15/28/0]	[46%]:[25/12/0/63/0]%:/29%/


Muutamia kommentteja / Some comment:

1.1: (A) Use temporary variable W(z) after the summing. 
     Notice that there is a feedback loop <-> denominator/jakaja 

1.4: Highpass: |H| strongest at omega=pi <=> z=exp(jw)=-1. 
     |H(z <- -1)| = |K (1 + 1 + 1 + 1)| = 1 
                                    4 K = 1 

1.7: Substitution: H(z) = 2k / [k ([1-z^-1]/[1+z^-1]) + 2k] 

1.8: In order to compute y[n], you should already know y[n]. 

1.11: Multirate - various ways to think it.
     Directly apply the formula. 
     Or iff fT=8 kHz, then pi corresponds 4 kHz, and the signal is at
     3..4 kHz. Downsample by 4: fTD = 2 kHz. Triangular spectrum
     aliases down to 0..1 kHz, e.g., by flipping around each pi.

1.12: Matlab #5, ideal lowpass filtering for an image.


Pistekeskiarvo / Mean:  N=52: 6.38 p / 12 p.
Histogrammi kokonaispisteistä nähtävillä / 
Histogram of total points: 
http://www.cis.hut.fi/Opinnot/T-61.3010/VK2_K2009/monivalinta_vk2B_k2009.png 



Tehtävä 2 / Problem 2 

2A: fft([-1 -4 2 3]) --> X[k]={_0_, -3+7j, 2, -3-7j} 
   Without bit-reversed order incorrectly {_0_, 3+j, -10, 3-j} 

2B: ASR.


Problem 3a and 3b, properties of a system, see
[P24],[P25]. "Open" h[n], that is a left-handed sequence,
growing without bound when n -> -oo.

Problem 3c, periodic signal [P20], 
$N_1 = 24$, $N_2=15$, $N_0 = 120$.

Problem 4, see [P33]. 
    h[n] = h1[n] + h2[n] (*) (h3[n] + h4[n])
    H(z) = H1(z) + H2(z) .   (H3(z) + H4(z))
Probably easier to z-transform first,
multiply and add, and then return back to time domain $h[n]$.
Finally $H(z)=1$, which is identity filter (doing nothing), 
allpass being closest.

Problem 5, see [P64], using temporary variables after
each summing unit, in this case only one $w[n]$ is needed.
H(z) = [ab - (a+b) z^-1 + z^-2] / [1 - (a+b) z^-1 + ab z^-2].
Poles are {a, b}, and therefore stability |a|<1, |b|<1.

Problem 6, see [P70]. Final $h[n]$ is a product of an ideal
(infinite-length) $h_d[n]$ (sinc) and a window function w[n].

    ^ |H|
    |______    |
  0 |------\   |
    |     | \  |
    |     |  \ |----------
-53 |     |   \___________
    ------------------------
    0     5    6        24

The purpose of w[n] is to cut (and modify) $h_d[n]$, therefore
h[2009] = 0, where 2009 > M, because $w[k] = 0$, when k > M or 
k < -M. Notice also, that h[n] is symmetric: h[-3] = h[3].
M was here about 80, that is, symmetrically around y-axis
$-M .. +M$, and the order therefore N=2M=160. Notice that
sin(pi x)/(pi x) -> 1, when x->0; derived to sinc: 
h[0] = (omega_c/pi) sinc(0) = omega_c/pi != 0 or != 1, [P7d].
See also formula table "Filter synthesis, Window method". 

Problem 7, see [P47], [P81]. Spectrum: three peaks
at frequencies 200, 1200 and 3400 with relative
amplitudes 3, 2, 1. fT=12000 -> DOWN6 -> fTD=2000.
Just like in A/D no frequency component "disappears"
but aliases down to base band 0..fTD/2 IF not anti-aliasing
LP-filtered. Now, with "flipping around each fT/2", see
[P48c], 3400 ->[3000]-> 2600 ->[2000]->1400 ->[1000]-> 600,
1200 ->[1000]-> 800. Anti-aliasing would be set to 
remove all components over fTD/2 ==1000 in order to ensure
that there will not be aliasing. In this case there
would be only 200 Hz left.

