Assign - 3 - Solution

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

UNIVERSITI TEKNOLOGI MALAYSIA

Faculty of Electrical Engineering

MKEL 1143
Advanced DSP
Solutions for Assignment 3

Problem 3.1

A stationary random signal 𝑥𝑛 is to be estimated on the basis of the noisy observations

𝑦𝑛 = 𝑥𝑛 + 𝜈𝑛

It is given that
1
𝑆𝑥𝑥 (𝑧) = , 𝑆𝑣𝑣 (𝑧) = 5, 𝑆𝑥𝜈 (𝑧) = 0
(1 − 0.5𝑧 −1 )(1 − 0.5𝑧)

(a) Determine the optimal realizable Wiener filter for estimating the signal 𝑥𝑛 on the basis of
the observation 𝑌𝑛 = {𝑦𝑖 , 𝑖 ≤ 𝑛}. Write the difference equation of this filter and compute
the mean-square estimation error.

Since 𝑥𝑛 and 𝜈𝑛 are uncorrelated, we have

1 1−0.4𝑧 −1 1−0.4𝑧
𝑆𝑦𝑦 (𝑧) = 𝑆𝑥𝑥 (𝑧) + 𝑆𝜈𝜈 (𝑧) = (1−0.5𝑧 −1 )(1−0,5𝑧) + 5 = 6.25 ∙ ∙
1−0.5𝑧 −1 1−0.5𝑧

Therefore, we identify the signal model for 𝑦𝑛 :


1 − 0.4𝑧 −1
𝐵(𝑧) = , 𝜎𝜖2 = 6.25
1 − 0.5𝑧 −1
1
Similarly, we find 𝑆𝑥𝑦 (𝑧) = 𝑆𝑥𝑥 (𝑧) = (1−0.5𝑧 −1 )(1−0.5𝑧). And

1
𝑆𝑥𝑦 (𝑧) −1
(1 − 0.5𝑧 )(1 − 0.5𝑧) 1 1.25
[ ] = [ ] = [ ] =
𝐵(𝑧 −1 ) + 1 − 0.4𝑧 (1 − 0.5𝑧 −1 )(1 − 0.4𝑧) + 1 − 0.5𝑧 −1
1 − 0.5𝑧 +

The corresponding Wiener filter is

Dr. Syed Abd. Rahman Al-Attas Advanced DSP Page - 1


1.25
1 𝑆𝑥𝑦 (𝑧) ( ) 0.2
𝐻(𝑧) = 2 [ ] = 1 − 0.5𝑧 −1 =
𝜎𝜖 𝐵(𝑧) 𝐵(𝑧 −1 ) + 1 − 0.4𝑧 −1 1 − 0.4𝑧 −1
6.25 ∙ −1
1 − 0.5𝑧
The difference equation for the estimator then is 𝑥̂𝑛/𝑛 = 0.4𝑥̂𝑛−1/𝑛−1 + 0.2𝑦𝑛 . The
estimation error is computed using the contour integral (you need to refer to DSP books
on this formulation).

[𝑆𝑥𝑥 (𝑧) ∙ 𝐻(𝑧)𝑆𝑦𝑥 (𝑧)]𝑧 𝑛−1 𝑑𝑧 0.8 𝑑𝑧


𝜀 = 𝐸 [𝑒𝑛2 ] = ∫ = ∫ 𝑧 𝑛−1 = 𝑅𝑒𝑠𝑥=0.4 = 1
𝑛 2𝜋𝑗𝑧 (𝑧 − 0.4)(1 − 0.5𝑧) 2𝜋𝑗
𝑢.𝑐 𝑢.𝑐.

(b) Determine the optimal realizable Wiener filter for predicting one step into the future: that
is, estimate 𝑥𝑛+1 on the basis of 𝑌𝑛 .

The prediction part is handled by defining 𝑥1 (𝑛) = 𝑥𝑛+1 . The problem of predicting 𝑥𝑛+1
on the basis of 𝑌𝑛 is equivalent to the problem of estimating 𝑥1 (𝑛) on the basis of 𝑌𝑛 .
Using the filtering equation 𝑋1 (𝑧) = 𝑧𝑋(𝑧), we find
𝑧
𝑆𝑥1 𝑦 (𝑧) = 𝑧𝑆𝑥𝑦 (𝑧) =
(1 − 0.5𝑧 −1 )(1 − 0.5𝑧)

The optimal prediction filter then

[𝐺(𝑧)]+ 𝑆𝑥1 𝑦 (𝑧) 𝑧


𝐻1 (𝑧) = , 𝑤ℎ𝑒𝑟𝑒 𝐺(𝑧) = =
𝜎𝜖2 𝐵(𝑧) −1 −1
𝐵(𝑧 ) (1 − 0.5𝑧 )(1 − 0.4𝑧)

The causal part of G(z) is found by first doing the PFE and choose all poles inside the
u.c.:

0.4
[𝐺(𝑧)]+ =
1 − 0.5𝑧 −1

0.1
𝐻1 (𝑧) = 𝑜𝑟, 𝑥̂𝑛+1/𝑛 = 04𝑥̂𝑛/𝑛−1 + 0.1𝑦𝑛
1 − 0.4𝑧 −1

where denoted 𝑥̂𝑛+1/𝑛 = 𝑥̂1 (𝑛). We note that the prediction filter 𝐻1 (𝑧)is related to the
estimation filter 𝐻(𝑧) by 𝐻1 (𝑧) = 0.5𝐻(𝑧). Since both filters have the same input, that is, 𝑦𝑛 , it
follows that

𝑥̂𝑛+1/𝑛 = 0.5𝑥̂𝑛/𝑛

Dr. Syed Abd. Rahman Al-Attas Advanced DSP Page - 2


Noting that 𝑆𝑥1 𝑥1 (𝑧) = 𝑧𝑆𝑥𝑥 (𝑧)𝑧 −1 = 𝑆𝑥𝑥 (𝑧), and 𝑆𝑦𝑥1 (𝑧) = 𝑆𝑦𝑥 (𝑧)𝑧 −1 , we find for the
prediction error

𝑑𝑧 1 𝑑𝑧
𝜀1 = 𝐸 [𝑒 2 1] = ∫ [𝑆𝑥1 𝑥1 (𝑧) ∙ 𝐻1 (𝑧)𝑆𝑦𝑥1 (𝑧)]𝑧 𝑛−1 = ∫ 𝑧 𝑛−1 = 1.25
𝑛+𝑛 2𝜋𝑗𝑧 (𝑧 − 0.4)(1 − 0.5𝑧) 2𝜋𝑗
𝑢.𝑐. 𝑢.𝑐.
This is slightly worse than the estimation error 𝜀 because the estimation filter uses one more
observation than the prediction filter, and thus, makes a better estimate.

Problem 3.2

A stationary random signal 𝑦𝑛 is sent through a finite filter 𝐴(𝑧) = 𝑎0 + 𝑎1 𝑧 −1 + ⋯ + 𝑎𝑀 𝑧 −𝑀 to


obtain the output signal𝑒𝑛 :
𝑀
𝑦𝑛 𝑒𝑛
𝐴(𝑧) 𝑒𝑛 = ∑ 𝑎𝑚 𝑦𝑛−𝑚
𝑚=0

Show that the average power of the output 𝑒𝑛 can be expressed in the two alternative forms:
𝜋
𝑑𝜔
𝐸[𝑒𝑛2 ] = ∫ 𝑆𝑦𝑦 (𝜔)|𝐴(𝜔)|2 = 𝒂𝑇 𝑅𝑦𝑦 𝒂
−𝜋 2𝜋

where 𝒂 = [𝑎0 , 𝑎1 , … , 𝑎𝑀 ]𝑇 and 𝑅𝑦𝑦 is the (𝑀 + 1) × (𝑀 + 1) autocorrelation matrix of 𝑦𝑛


having matrix elements 𝑅𝑦𝑦 (𝑖, 𝑗) = 𝐸[𝑦𝑖 𝑦𝑗 ] = 𝑅𝑦𝑦 (𝑖 − 𝑗).

Solution

First let write the error sequence, 𝑒𝑛 , in a vector form

𝑀 𝑦𝑛
𝑦𝑛−1
𝑒𝑛 = ∑ 𝑎𝑚 𝑦𝑛−𝑚 = [𝑎0 , 𝑎1 , … , 𝑎𝑀 ] [ ⋮ ] = 𝐚𝑻 𝐲(𝒏)
𝑚=0 𝑦𝑛−𝑀

Its mean square then becomes:

𝐸[𝑒𝑛2 ] = 𝐸[(𝐚𝑻 𝐲(𝒏))(𝐲(𝒏)𝑻 𝐚] = 𝐚𝑻 𝐸[𝐲(𝒏)𝐲(𝒏)𝑻 ]𝐚 = 𝐚𝑻 𝑹𝒚𝒚 𝐚

where 𝑹𝒚𝒚 = 𝐸[𝐲(𝒏)𝐲(𝒏)𝑻 ]. Its matrix elements are expressed in terms of the autocorrelation
lags, as follows:

(𝑹𝒚𝒚 ) = 𝐸[𝑦𝑛−𝑖 𝑦𝑛−𝑗 ] = 𝑹𝒚𝒚 (𝑛 − 𝑖 − 𝑛 + 𝑗) = 𝑹𝒚𝒚 (𝑗 − 𝑖) = 𝑹𝒚𝒚 (𝑖 − 𝑗)


𝑖𝑗

Dr. Syed Abd. Rahman Al-Attas Advanced DSP Page - 3


The second expression for 𝐸[𝑒𝑛2 ] is obtained by noting that it is expressible as the zero-lag
autocorrelation of 𝑒𝑛 :

𝜋 𝜋
𝑑𝑤 𝑑𝑤
𝐸[𝑒𝑛2 ] = 𝑅𝑒𝑒 (0) = ∫ 𝑆𝑒𝑒 (𝜔) = ∫|𝐴(𝜔)|2 𝑆𝑦𝑦 (𝜔)
2𝜋 2𝜋
−𝜋 −𝜋

where we used eqn (10) from Modul 2a – Random Process as well as 𝑆𝑒𝑒 (𝜔) = |𝐴(𝜔)|2 𝑆𝑦𝑦 (𝜔),
which follows from the fact that 𝑒𝑛 is the output of the linear filter 𝐴(𝑧) when the input is 𝑦𝑛 .

Problem 3.3

Consider the two autoregressive random signals 𝑦𝑛 and 𝑦𝑛′ generated by the two signal models:

𝐴(𝑧) = 1 + 𝑎1 𝑧 −1 + ⋯ + 𝑎𝑀 𝑧 −𝑀 and 𝐴′ (𝑧) = 1 + 𝑎1′ 𝑧 −1 + ⋯ + 𝑎𝑀


′ −𝑀
𝑧

𝜖𝑛 1 𝑦𝑛 𝜖′𝑛 1
𝑦′𝑛
𝐴(𝑧) 𝐴′ (𝑧)

(a) Suppose 𝑦𝑛 is filtered through the analysis filter 𝐴′ (𝑧) of 𝑦𝑛′ producing the output signal
𝑒𝑛 ; that is,

𝑀
𝑦𝑛 𝑒𝑛
𝐴′ (𝑧) ′
𝑒𝑛 = ∑ 𝑎𝑚 𝑦𝑛−𝑚
𝑚=0

If 𝑦𝑛 were to be filtered through its own analysis filter 𝐴(𝑧), it would produce the
innovations sequence 𝜖𝑛 . Show that the average power of 𝑒𝑛 compared to the average
power of 𝜖𝑛 is given by:

𝑇 2 2
𝜎𝑒2 𝒂′ 𝑅𝑦𝑦 𝒂′ 𝝅
𝐴′ (𝜔) 𝑑𝜔 𝐴′
= = ∫ | | = ‖ ‖
𝜎𝜖2 𝒂𝑇 𝑅𝑦𝑦 𝒂 −𝝅 𝐴(𝜔) 2𝜋 𝐴

where 𝒂, 𝒂′ and 𝑅𝑦𝑦 have the same meaning as in Problem 2.2 above. This ratio can be
taken as a measure of similarity between the two signal models. The log of this ratio is

Dr. Syed Abd. Rahman Al-Attas Advanced DSP Page - 4


Itakura’s Linear Predictive Coefficient (LPC) distance measure used in speech
recognition.

Solution

Because 𝐵(𝑧) = 1/𝐴(𝑧) is the signal model of 𝑦𝑛 , we must have:

𝜎𝜖2
𝑆𝑦𝑦 (𝜔) = 𝜎𝜖2 |𝐵(𝜔)|2 =
|𝐴(𝜔)|2

Using the results of Problem 2.3 above, applied to the filter 𝐴′ (𝑧), we find
𝜋
𝑑𝑤
𝜎𝑒2 = 𝐸[𝑒𝑛2 ] = ∫ |𝐴′ (𝜔)|2 𝑆𝑦𝑦 (𝜔) = 𝐚′𝑻 𝑹𝒚𝒚 𝐚′ 𝑜𝑟,
2𝜋
−𝜋

𝜋
𝜎𝜖2 𝑑𝑤
𝜎𝑒2 = ∫ |𝐴′ (𝜔)|2 = 𝐚′𝑻 𝑹𝒚𝒚 𝐚′
|𝐴(𝜔)|2 2𝜋
−𝜋

Applying Problem 2.3 to 𝜀𝑛 itself, we get 𝜎𝜖2 = 𝐚𝑻 𝑹𝒚𝒚 𝐚. We finally find

𝜋 2
𝜎𝑒2 𝐴′ (𝜔) 𝑑𝜔 𝐚′𝑻 𝑹𝒚𝒚 𝐚′
= ∫| | = 𝑻
𝜎𝜖2 𝐴(𝜔) 2𝜋 𝐚 𝑹𝒚𝒚 𝐚
−𝜋

(b) Alternatively, show that if 𝑦𝑛′ were to be filtered through 𝑦𝑛′ analysis filter 𝐴(𝑧) resulting
in 𝑒𝑛′ = ∑𝑀 ′
𝑚=0 𝑎𝑚 𝑦𝑛−𝑚 then

2
2
𝜎𝑒′ 𝒂𝑇 𝑅′𝑦𝑦 𝒂 𝝅
𝐴(𝜔) 𝑑𝜔 𝐴 2
= = ∫ | | =‖ ‖
𝜎𝜖′2 𝒂′𝑇 𝑅′𝑦𝑦 𝒂′ −𝝅 𝐴′(𝜔) 2𝜋 𝐴′

Solution

Part (b) is obtained by interchanging the roles of 𝐴′ (𝑧) 𝑎𝑛𝑑 𝐴(𝑧).

Problem 3.4 (Scilab Assignment)

Consider the linear system defined by the following impulse response:

ℎ𝑘 = (0.25)𝑘 cos(0.1𝜋𝑘) + (0.7)𝑘 cos(0.3𝜋𝑘) , 0 ≤ 𝑘 ≤ 50

Dr. Syed Abd. Rahman Al-Attas Advanced DSP Page - 5


Generate 1500 samples of a unit-variance, zero-mean, white-noise sequence 𝑥𝑛 𝑛 = 0,1, … ,1499
and filter them through the filter 𝐻 to obtain the output sequence 𝑦𝑛 . Compute the sample cross-
correlation 𝑅̂𝑦𝑥 (𝑘) for 𝑘 = 0,1, … , 50 to obtain estimates of the impulse response ℎ𝑘 . On the
same graph, plot the estimated impulse response versus time, together with the actual impulse
response. Repeat, using a different realization of 𝑥𝑛 .

You can use the Scilab coding given in the System Identification example. You should get
something that looks like below:

Problem 3.5 (Scilab Assignment)

(a) Generate 1000 samples of zero-mean, unit-variance, white Gaussian noise sequence 𝑥𝑛 ,
𝑛 = 0,1, … , 999, and filter them through the filter defined by the difference equation:

𝑦[𝑛] = 𝑎𝑦[𝑛 − 1] + (1 − 𝑎)𝑥[𝑛]

with 𝑎 = 0.95. to avoid the transient effects introduced by the filter, discard the first 900
output samples and save the last 100 samples of 𝑦𝑛 . Compute the sample autocorrelation
of 𝑦𝑛 from the length-100 block samples.

(b) Determine the theoretical autocorrelation 𝑅𝑦𝑦 (𝑘), and on the same graph, plot the
theoretical and sample autocorrelations versus k. Do they agree?

We can compute this using the notes in module 2


0.05
From (a), we compute 𝐻(𝑧) = and taking the inverse z-xform gives us the
1−0.95𝑧 −1
impulse response ℎ[𝑛] = 0.05(0.95)𝑛 𝑢[𝑛].

Dr. Syed Abd. Rahman Al-Attas Advanced DSP Page - 6


Then, 𝑅𝑦𝑦 (𝑘) = 𝜎𝑥2 ∑∞ 2 ∞
𝑛=0 ℎ𝑛+𝑘 ℎ𝑘 = 0.05 ∑𝑛=0 0.95
𝑛+𝑘
0.95𝑛 =
0.052 0.95𝑘 ∑∞
𝑛=0 0.95
2𝑛

0.052 0.95𝑘
Hence 𝑅𝑦𝑦 (𝑘) = = 0.0256(0.95𝑘 )
1−0.952

The sample autocorrelation to some extend is a rough estimation of the theoretical


autocorrelation.

Problem 3.6

A filter is defined by 𝑦[𝑛] = −0.64𝑦[𝑛 − 2] + 0.36𝑥[𝑛].

(a) Suppose the input is zero-mean, unit-variance, white noise. Compute the output spectral
density 𝑆𝑦𝑦 (𝑧) and power spectrum 𝑆𝑦𝑦 (𝜔) and plot it roughly versus frequency.

(b) Compute the output autocorrelation 𝑅𝑦𝑦 (𝑘) for all lags k.

(c) Compute the noise reduction ratio of this filter.

(d) What signal 𝑠[𝑛] can pass through this filter and remain entirely unaffected (at least in the
steady-state region)?

(e) How can the filter coefficients be changed so that (i) the noise reduction capability of the
filter is improved, while at the same time (ii) the above signal 𝑠[𝑛] still goes through
unchanged? Explain any tradeoffs

Dr. Syed Abd. Rahman Al-Attas Advanced DSP Page - 7


Solution

From the above LCCDE, we obtained

0.36 0.36
𝐻(𝑧) = =
1 + 0.64𝑧 −2 (1 − 𝑗0.8𝑧 −1 )(1 + 𝑗0.8𝑧 −1 )

(a) The power spectral density then

0.362
𝑆𝑦𝑦 (𝑧) = 𝜎𝑥2 𝐻(𝑧)𝐻(𝑧 −1 ) = , 𝑤𝑖𝑡ℎ 𝜎𝑥2 = 1
(1 + 0.64𝑧 −2 )(1 + 0.64𝑧 2 )

The power spectrum is obtained by setting 𝑧 = 𝑒 𝑗𝜔 .

0.1296 0.1296
𝑆𝑦𝑦 (𝜔) = −2 2
=
(1 + 0.64𝑧 )(1 + 0.64𝑧 ) 1.4096 + 1.28 cos(2𝜔)

(b) The autocorrelation function is obtained by performing the partial expansion fraction and
then select the poles inside the u.c. only. Doing this we should get the following

𝜋𝑘
𝑅𝑦𝑦 (𝑘) = 0.2195(0.8)𝑘 cos ( )
2
for 𝑘 ≥ 0

(c) Since 𝜎𝑦2 = 𝑅𝑦𝑦 (0), we find for the noise reduction ratio

𝜎𝑦2 𝑅𝑦𝑦 (0)


= = 0.2195
𝜎𝑥2 1
𝜋
(d) Since the filter has unity gain at the frequencies 𝜔 = ± , 𝐻(𝜔) = 1, it follows that any
2
linear combination of
𝜋𝑛 𝜋𝑛
sin ( ) 𝑎𝑛𝑑 cos ( )
2 2
will go through the filter completely unchanged (in the steady state).

(e) By letting the poles closer to the unit circle, the steady state is reached more slowly, but
the noise reduction ratio will become smaller. This is the basic tradeoff between speed of
response and the effective noise reduction.

Dr. Syed Abd. Rahman Al-Attas Advanced DSP Page - 8