You are on page 1of 12

Lab Instructions for Digital Signal Processing:

Part II. Application of optimum filters (Wiener and Kalman filters)

The laboratories are intended to provide you with the opportunities to solve practical problems by applying
the knowledge you get in the course. There are two laboratories: one is concerned with signal analysis and
modeling, and the other is focused on designing optimal filters, including Wiener and Kalman filters. This
instruction is for the second laboratory.
In the second laboratory you will apply Wiener filtering to noise cancellation and Dolby-C, and Kalman
filtering to prediction of mobile radio channels. To fulfill the tasks in the lab, you need to use both MATLAB
V 6.5 and the MATLAB-based program LabGUI 1.3. The manual of LabGUI 1.3 is available in the lab.

The core concepts of optimum filters

Optimum filtering is concerned with the designing of optimum filters by minimizing the mean square error
ξ ( n ) = E{| e( n ) |2 } (1)
where
e( n ) = x ( n ) − xˆ ( n ) (2)
is the error between the desired signal x(n) and its estimate xˆ ( n ) . It plays an indispensable role in signal
processing.
Among the most widely-used optimum filters are Wiener and Kalman filters, which were named after Dr.
Norbert Wiener and Dr. Rudolf Emil Kalman. For their biographies please see Appendices A and B.
In Wiener filter theory, the criterion used to optimize the filter is the minimal mean-square error
[ ]
ξ min ( n ) = min E{| e( n ) |2 } , (3)
and the Wiener-Hopf equations that are, thus, obtained are used to determine the optimum filter coefficients.
In Kalman filter theory the criterion used is the minimized state error covariance matrix
ξ min ( n ) = min[tr{P( n | n )}] (4)
{ }
where P( n | n ) = E e( n | n )e H ( n | n ) is the state error covariance matrix, and e( n | n ) = x( n ) − xˆ ( n | n ) is the
error vector between the state vector x(n) and its estimate xˆ ( n | n ) . In this case the optimum Kalman gain
matrix K(n) is obtained.
In the optimum sense, the Wiener filters can only be used to deal with stationary signals, whereas the
Kalman filters can be employed to cope with both stationary and non-stationary signals.

Task 1. Active Noise Cancellation (or Active Noise Control)

In the first task you will find the application of FIR Wiener filters to active noise cancellation (ANC) (or
active noise control).

Background
One may feel annoyed at any of such environments full of unwanted noise from automobile interiors, jet
engines, heating, ventilation and air conditioning systems, electric motors, transformers and vehicle exhaust

1
systems. Over the last half century, the development of control techniques to cancel such noises has received
a great deal of attention. Passive noise absorption and active noise cancellation approaches have been used to
design controllers for noise reduction. Various passive noise reduction techniques have been implemented
using absorbent materials; however, the absorbent material must be of the same physical dimension as the
noise wavelength. Motivated by, for example, the need to install approximately 0.25 [m] of damping material
to absorb a low-frequency noise of 200 [Hz], researchers have turned to active noise cancellation (ANC)
techniques for low frequency acoustic noise.
The ANC involves the use of a controllable, "secondary" source to generate a reference (noise) signal that
destructively interferes with the unwanted noise in the original, "primary" source so that the desired signal
can be enhanced. The ANC has been seen in a large variety of applications, such as in
• local and long distance telecommunications
• answering machines, cordless phones, hand- free speaker phones, mobile phones, car phones
• internet telephony and PC telephony
• call service centers
• speech communications on board aircrafts and space shuttles
• large scale IC manufacturing
• voice recognition
• hearing aids
• voice logging systems
• audio products
You can see several examples of the removal of different types of noises in the small movies presented in (by
running) noise_cancellation.exe in the directory: LabGUIv1.3/Work/Signalbehandling/.

Active noise cancellation (ANC) based on (adaptive) FIR Wiener filters


The ANC can be implemented with various methods. As the signals (or random processes), e.g., speech and
audio signals, noise from aircrafts and automobiles, etc., in nature are mostly non-stationary, a linear shift
invariant (LSI) Wiener filter can not be optimum for such signals. In this case, an adaptive filter, i.e., a shift
variant (time-varying) filter that retains the optimum for processing non-stationary signals, is commonly
used.
In this ANC task, we will use an FIR Wiener filter as well as its extension, an FIR adaptive filter that is
just an FIR Wiener filter with a time-varying system function.

A. Non-stationary processes
A non-stationary process is a random process whose statistical properties are not stationary. In other
words, they are time varying. A simple example is a measurement a deterministic sinusoidal signal
d ( n ) = A sin(ωn + ϕ ) interfered with stationary noise signal v(n) is a non-stationary random process
x ( n ) = d ( n ) + v ( n ) because the mean of x(n),
m x ( n ) = A sin(ωn + ϕ ) ,
depends on time n, and the autocorrelation,
rx ( n + k , n ) = rv ( k ) + ( A2 2){cos(ωk ) − cos[ω ( 2n + k ) + 2ϕ ]},
depends not only on time lag k but also on time n. The cross-correlation
rdx ( n + k , n ) = ( A2 2){cos(ωk ) − cos[ω ( 2n + k ) + 2ϕ ]}
also depends on time n.

2
B. FIR Wiener and FIR adaptive filters
p −1
As we have learnt, an FIR Wiener filter of (p–1)th order, W ( z ) = w(l ) z −l , can only be used to treat
l =0

stationary signals in the optimum sense because it is designed based on the Wiener-Hopf equations
p −1
w(l )rx (k − l ) = rdx ( k ) , k = 0, 1, , p − 1 , or R x w = rdx , (5)
l =0
in which rx (k ) and rdx (k ) are the auto- and cross-correlations from the stationary processes x(n) (that
contains d(n)) and d(n).
As a non-stationary signal has a time varying autocorrelation matrix R x (n ) and vector rdx (n ) , an FIR
Wiener filter that retains optimum (i.e., the minimized mean square error) has to change with time n, namely
its coefficients wn (l ) are time varying, so that the optimum relations
R x ( n ) w n = rdx ( n ) , where w n = [wn (0) wn (1) wn ( p ) ]
T
(6)
are valid for all n. Such an FIR optimum filter with the time varying coefficients wn (l ) , or a time varying
p −1
system function Wn ( z ) = wn (l ) z −l , is known as FIR adaptive filter, which, in block diagram, is illustrated
l =0

in Fig. 1. For a stationary process, the FIR adaptive filter functions as an ordinary FIR Wiener filter.

Fig. 1. FIR adaptive filter with time varying system


function

Since R x (n ) and rdx (n ) (i.e., rx ( n + k , n ) and rdx ( n + k , n ) ) in most


cases (unlike in the above-mentioned noise-interfered sinusoidal
process) are unknown, and solving Eq. (6) for the time varying
coefficients wn (l ) is impractical in most real-time implementations.
Instead people have considered iterative approaches, and developed a
variety of adaptive algorithms, such as the least mean square (LMS),
normalized LMS (NLMS), recursive least squares (RLS), etc.
In the LMS algorithm the time-varying coefficients of the filter
are of the following simple form
w n +1 = w n + µe( n )x * ( n ) , or (7a)
wn +1 ( k ) = wn ( k ) + µe( n ) x * ( n − k ) (7b)
where e( n ) = d ( n ) − dˆ ( n ) (see Fig. 1), and µ is the step size that
affects the rate at which w n converges to a stable-valued vector, and
is always a positive number. The initialization for calculating w n is
w 0 =0.

C. Active noise cancellation using an FIR adaptive filter


Now let us look at a communications headset (Fig. 2) that can be Fig. 2. A communications headset
used in various noise situations such as in used in noise situations.

3
• space shuttles
• auto racing
• fire trucks and emergency response vehicles
• mining operations
• construction equipment operations
• power-generating stations
• military applications, including aircraft carrier deck operations, mobile fighting vehicles (tanks and
armored personnel carriers), and aircraft engine test facilities
• aviation and airport operations
• manufacturing
• oil and gas drilling
The ANC is used in such a headset in order to overcome corrupted voice transmissions in noisy
environments during operations. The microphone in front of the operator's mouth is the primary sensor that
receives both the speech (the desired signal) and the ambient noise, and the AN (active noise) microphone on
the left tilted dome is the secondary sensor that receives only the ambient noise used for canceling the noise
received in the primary sensor.
Suppose that an FIR adaptive filter (or an FIR Wiener filter) is used in such a headset for the ANC. The
principle of the ANC system can be illustrated in a block diagram in Fig. 3.
The primary sensor receives
noise-corrupted voice x(n)
x ( n ) = d ( n ) + v1 (n )
where d(n) is the desired signal
and v1 ( n ) is the ambient noise.
The secondary sensor receives
the ambient noise v 2 ( n ) that will
be correlated with v1 ( n ) . But
v 2 ( n ) ≠ v1 ( n ) . This may result
from a number of factors: such
Fig. 3. Active noise cancellation (ANC) using an FIR adaptive filter. as the differences in the two
sensor characteristics, the
differences of the noise propagation paths, and the leakage of the signal d(n) into the secondary sensor. Since
v 2 ( n ) ≠ v1 ( n ) , we can not cancel v1 ( n ) by simply doing a subtraction, x(n) − v 2 ( n ) . Instead, we use a
Wiener filter or an adaptive filter to estimate the noise v1 ( n ) in x(n), and then subtract the estimate vˆ1 ( n )
from x(n) so as to get the noise reduced estimate of d(n), which is given by dˆ ( n ) = x ( n ) − vˆ ( n ) . The noises 1
v 2 ( n ) and v1 ( n ) in general are non-stationary. But they may often be characteristic of zero-mean processes,
and both are uncorrelated with the desired signal d(n) that can be both random and deterministic.
When an FIR Wiener filter (that takes the place of the adaptive filter in Fig. 3) is used for ANC, its
coefficients are determined by the Wiener-Hopf equations
R v2 w = rv1v2 (9a)
since rv1v2 (k ) = E {v1 (n )v 2 ( n − k )} = E{[x ( n ) − d ( n )]v 2 ( n − k )} = E{x ( n )v 2 ( n − k )} = rxv2 ( k ) , then we have
R v2 w = rxv2 (9b)
When an adaptive filter is employed for ANC, its time-varying coefficients are determined using the LMS
algorithm in Eq. (7), which, for the ANC in Fig. 3, becomes w n +1 = w n + µe( n ) v *2 ( n ) where e( n ) = dˆ (n ) .

4
What to do

Look at several examples of ANC in the small movies presented in (by running) noise_cancellation.exe
in the directory: LabGUIv1.3/Work/Signalbehandling/.
Apply an FIR Wiener filter and an FIR adaptive filter to the ANC in two different noise environments:
stationary noise and non-stationary noise environments. The desired signal d(n) is a deterministic sinusoid.
In the stationary noise case, the noisy signal x(n) and the noise v 2 ( n ) from the primary and secondary
sensors are in files stat_noise_canc_x.mat, in stat_noise_canc_v2.mat, respectively. This can be related
to such a real situation that an airplane flew at a constant speed.
In the non-stationary noise case, x(n) and v 2 ( n ) from the primary and secondary sensors are in files
non_stat_noise_canc_8820_x.mat and non_sstat_noise_canc_8820_v2.mat, respectively. This can
be related to such a real situation that an airplane flew at different speeds.
In both cases, firstly make a simple subtraction, x(n) − v 2 ( n ) , and see if a sinusoid is recognizable,
secondly use Wiener and adaptive filters to process v 2 ( n ) and find the estimate vˆ1 ( n ) , and then subtract
vˆ ( n ) from x(n) and obtain the estimated desired signal dˆ ( n ) .
1

How to do

Use LabGUI 1.3 to fulfill the task.


You can load the .mat files by clicking the Signal button and point to Load → Input → *.mat file, and
perform Addition, Subtraction, Multiplication and Convolution by clicking the Tools button and point to
Operators, and conduct Filter by clicking the Tools button and point to Filter.
(1) Simple subtraction x(n) − v 2 ( n )
For the stationary noise case, load stat_noise_canc_x.mat for the noisy signal x(n) and then
stat_noise_canc_v2.mat for the noise v 2 ( n ) , give a name to each signal, perform a subtraction of x(n)
− v 2 ( n ) , and see if the noise is reduced.
Do these also for the non-stationary noise case with files non_stat_noise_canc_8820_x.mat and
non_stat_noise_canc_8820_v2.mat.
(2) Perform the ANC for both stationary and non-stationary noise cases using the FIR Wiener and adaptive
filters available in LabGUI 1.3. Both filters are of 12th order. In this case, the filter is used to process the
noise v 2 ( n ) to obtain vˆ1 ( n ) , and then get the estimated desired signal dˆ ( n ) from x(n) − vˆ1 ( n ) .
Note that v 2 ( n ) and x(n) must be in the Input signal and Output signal slots in the Active signals
window, respectively, to get the correct cross-correlation between x(n) and v 2 ( n ) .
(i) For the FIR Wiener filter to process the stationary noise v 2 ( n ) in stat_noise_canc_v2.mat, select
Optimal filters in the Main functions window and then the Optimal filters window appears in which you
choose FIR Wiener, and input q = 13 for the 12th order. Click on the Save the model to and then on
the WS so as to get coefficients (e.g., Acoeff for A(z), Bcoeff for B(z)) for later use. Press the Plot
botton, give a name to the coefficients obtained, e.g., Bcoeff_st, and you get the FIR Wiener filter.
Now use the FIR Wiener filter to get vˆ1 ( n ) . Click the Tools button and point to Filters → From WS.
Now a filter_win window shows up. Type Bcoeff in the numerator and 1 (one) in the denominator,
click the OK button and now you get vˆ1 ( n ) in the Time domain window.
Perform the subtraction x(n) − vˆ ( n ) and get the estimated desired signal dˆ ( n ) .
1

5
(ii) For the FIR adaptive filter to process v 2 ( n ) in stat_noise_canc_v2.mat, select Adaptive filters in
the Main functions window and then the Adaptive filters window appears in which you choose LMS (for
the FIR adaptive) and type 12 in Order. Type 0.001 in My (for the step size µ ), and choose
stationary. The values for Nr of frequency and Section length are equal. Type 13 zeros in [0 0 … 0]
in a0 for the initialization w 0 =0 (since we have 13 coefficients, w0 (0) , w0 (1) , …, w0 (12) ). Click on
the Save the model to and then on the WS. Press the Plot botton, give a name to the coefficients
obtained, and you get the FIR adaptive filter.
Do the rest in the same way as in (i) get dˆ ( n ) .
For the non-stationary noise case, use the similar procedure. Load non_stat_noise_canc_8820_x.mat
and non_stat_noise_canc_8820_v2.mat, and then use FIR Wiener and LMS to process the non-
stationary noise v 2 ( n ) . For the FIR Wiener filter you get dˆ ( n ) in exactly the same way as in the
stationary noise case. For the LMS filter, however, use the values 44100 and 8820 for Nr of frequency
and Section length, respectively, and choose non-stationary. The rest steps are the same as in the
stationary noise case.

In the report

(1) Describe whether or not you can clearly see the sinus signal from a simple subtraction x(n) − v 2 ( n ) .
(2) Include in the report the processed results, namely the plots of the estimated desired signals dˆ ( n )
obtained using the FIR Wiener and adaptive filters for both the stationary and non-stationary noise
cases.
(3) Determine the frequency of the sinus signal.
(4) Compare and analyze the results, and remark the performances of the FIR Wiener and LMS for both the
stationary and non-stationary noise cases (e.g., the FIR Wiener is good only for stationary processes and
the LMS adaptive filter is good for stationary and non-stationary processes, and why so, etc).
(5) Point out what type(s) the filters are, i.e., lowpass, bandpass or highpass.
(6) Are the noisy signals x ( n ) = d ( n ) + v1 (n ) stationary or non-stationary for two noise environments?

Task 2. Improving DOLBY Noise Reduction Systems Using Wiener Filtering

In this task you will apply a causal IIR Wiener filter to improve the performance of DOLBY B, C and S noise
reduction systems that are used to enhance the signal-to-noise ratio for cassette tapes.

Background on 1DOLBY B, C, AND S NOISE REDUCTION SYSTEMS


Cassette tape gives a noise spectrum, without Noise Reduction, which appears to be concentrated in the
high frequencies. That's why we refer to hiss rather than roar or rumble. The DOLBY noise reduction
systems are established based on this hiss feature so as to make cassettes sound better.

Dolby noise reduction is a two-step process:


Step 1.

1
Taken directly from http://www.dolby.com/cassette/bcsnr/common.html

6
When music is being recorded, it is encoded just before reaching the tape. The purpose of encoding is to
raise the level of soft, high-frequency passages so they become louder than the tape's noise. During the trip
through the Dolby encoder, loud passages (that hide tape hiss) are not altered. Soft, high-frequency
passages (that tape hiss affects) are made louder than normal as they are recorded on the tape.

Step 2.

When playing back the tape, the sound is decoded by a precise mirror-image process of the encoding in
Step 1. The loud sounds are left unaltered, while the soft, high-frequency sounds are lowered back down to
their original levels. (You may have noticed that Dolby B tapes sound brighter when played without any
Noise Reduction decoding. Now you know why! You are hearing the encoded sound, not the original.

NOISE REDUCTION TAKES PLACE DURING DECODING. Tape Hiss is added to the recording during the
recording process. In step 1 we learned that the Dolby encoder boosted (made louder) the soft, high-
frequency passages before the signal reached the tape and before tape hiss was mixed in.

During Step 2, the Dolby decoder doesn't "know," as it scans the signal coming off the tape, that tape noise
has been added to the music–it just goes about the business of reducing the encoded sounds to their
original levels, with the noise automatically getting the same treatment. The result? Completely restored
musical balance but with less hiss in the reproduced sound (see figure 4).

Figure 4. How Dolby noise reduction works.

Such encode-decode systems are generally called "companders." They compress the range between loud
and soft when recording and expand the range back again on playback, and reduce noise in the process.
While Dolby B-type, C-type, and S-type noise reduction systems all operate as companders, there are many
differences in the amount of noise reduction, the methods used to achieve it, and the level of technology
used in each.

IIR Wiener filter for improving DOLBY noise reduction systems

A DOLBY system operates as a compander for noise reduction. Use of Wiener filtering with the DOLBY system can
lead to further noise reduction so as to improve the performance of the DOLBY noise reduction system.

7
Consider the system structure in Fig 14 from the lecture handouts, where we could incorporate the Dolby noise
reduction system:

Fig. 14. A general structure for causal IIR Wiener filter problems.

1. The desired signal d(n) is in this case the original music soundtrack.
2. The Dolby encoding is done by the filter Hs(z)=B(z)/A(z), generating the encoded music soundtrack in signal s(n).
This filter has high-pass characteristics, since we want to expand the treble of the soundtrack.
3. The tape hiss, mentioned in the description by Dolby, is generated by filtering white noise with variance σ2w=0.05,
through a high-pass filter Hv(z).
4. When the encoded music is recorded onto the tape, the signal y(n) is created by adding tape hiss to the encoded
music.
5. Since we are only filtering the signal, the time-delay m is set to zero.
6. The optimal filter H(z) will try to re-generate the desired signal d(n) from y(n), by reversing the encoding filter
(compressing the treble) and thus reducing the noise.

What to do:
1. Load the signals ”drums.wav” and ”hiss.wav” into the LabGUI
2. Listen to ”drums.wav” that is a noise free music
3. Encode the music
a) Select ”drums” as the input signal
b) In the menu, choose Tools->Filter->From WS
c) Insert the high-pass filter [-0.0462 0.9076 -0.0462] in the numerator and 0.6 in the denominator
d) Click OK
e) Give it the name ”encoded_drums”
4. Add the tape hiss to the encoded music
a) Select ”encoded_drums” as the input signal
b) Select ”hiss” as the output signal
f) In the menu, choose Tools->Operator->Add
g) Give the tape hiss ”hiss” a weight of 0.05
c) Give the name ”recorded_drums” to the sum of the two signals
d) Click OK
5. Listen to the signal ”recorded_drums” with special attention to the hiss.
6. Create the IIR Wiener filter to decode the music
a) Select ”Optimal filters” in the leftmost column of the LabGUI
b) Select ”IIR Wiener” in the option-bar at the right of the LabGUI window

8
c) Insert the appropriate values into the fields
Set "m" to be 10, ”Var w” to be 10 and ”Var ny” to be 1
”A” and ”B” are given as the high-pass FIR filter above
”N” and ”M” are [1] and [0.0284 -0.2370 0.4692 -0.2370 0.0284] respectively
Set ”C” and ”D” to 1 (the music process is actually not stationary, and thus the Wiener filter will not be
optimal, but it might be good enough in this case)
d) Select ”Save to WS” to save the resulting filter parameters to the workspace
e) Click ”Plot”
7. Fliter the signal ”recorded_drums” with the filter you created
a) Select ”recorded_drums” as the input signal
b) In the menu, choose Tools->Filter->From WS
c) Insert the names och the Wiener filter coefficients in the workspace
d) Click OK
e) Give the resulting signal the name ”decoded_drums”
8. Listen to the resulting soundtrack with special attention on the hiss, and compare with the 'recorded sound'

In the report:
(1) Draw some conclusions from the results, e.g., how good the decoded music is.
(2) Tell what the IIR Wiener filter should be like for a noise free situation, i.e., what are the filter's coefficients? Why?
(3) Discuss why and how the IIR Wiener filter can improve the performance of the DOLBY systems.

Task 3. Prediction of mobile radio channels

In this task you employ the Kalman filter to predict mobile radio channels.

Background on the prediction of mobile radio channels

In a wireless mobile communication system, a signal


can travel from transmitter (e.g., a radio base station) to
receiver (e.g., a mobile phone) over a radio channel
often consisting of multiple reflective paths; this is
referred to as multipath propagation. The multipath
propagation results in 'multi-path reception' at the
receiver (Fig. 5). The signal received by the receiver
Fig. 5. multi-path reception. contains not only a direct line-of-sight radio wave, but
also a large number of reflected, and scattered radio waves. These waves may interfere constructively at one
place and destructively at others when the receiver moves. This can cause fluctuations in the received
signal’s amplitude, phase, and angle of arrival, giving rise to the terminology multipath fading.
The multipath fading effect may give rise to a variation of signal strength (or of the SNR) up to 10 dB
from one time interval (place) to the next, e.g., when one uses a GSM mobile phone in a moving car. GSM
(that stands for the Groupe Spécial Mobile committee tasked to specify a pan-European cellular radio

9
system) is a system using a combined time division multiple access (TDMA) and frequency division multiple
access (FDMA) scheme. The available spectrum is partitioned into a number of bands, and each of these
bands may be occupied by a Gaussian minimum shift keying (GMSK) modulated RF carrier supporting a
number of TDMA time slots.
To avoid the data transfer loss caused by the channel fading effect, people have developed models to
estimate and predict this time varying mobile radio channel so that the modulation can be designed to adapt
to the channel situation in such way that the data is transferred in a smaller amount at the fading dips and in a
larger amount at the fading nodes. The prediction can be made from the received data to obtain snapshots of
the impulse response of the channel. Consecutive snapshots give the history of the channel variation. These
observations are then used to form a prediction of the future channel impulse response.
A broadband mobile radio channel can be modeled as a finite extent tapped-delay line filter, with a
discrete-time finite impulse response (FIR). The time evolution of the channel taps can be described by a
time varying ARMA or AR-process. The time variability has two components, a slow change due to the
changing angles and distances to the reflectors and scatterers and a more abrupt change due to the birth and
death process of the reflectors/scatterers. When there are no dominating close scatterers or abrupt changes,
the models can be approximated as time invariant for several meters.

Statement of the problem


Think that you drive a car at a speed of about 30 km/h in a city and use a GSM mobile phone, and at one
moment there are four large reflectors (e.g., large buildings) surrounding you. The radio signal at the
moment reflects on the reflectors, which results in four reflected waves in your mobile radio channel.
Assume that the reflected waves are from four different directions: one from front, one from back and two
from sides. Now consider a simple situation where there is one tap that has energy in the channel's impulse
response. The channel tap in this case is described by an AR process as follows
p
A( q −1 ) x (n ) = w( n ) , where A( q −1 ) = 1 + a ( k )q − k (10)
k =1

where x(n) is the channel's tap value at time instant n, and w(n) is the process (white) noise with a zero mean
and a variance of σ w2 . The observation y(n) of the tap x(n) is noisy, expressed by
y (n ) = x ( n) + v (n ) (11)
where v(t) is a complex white noise process with a zero mean and a variance σ v2 , and uncorrelated with w(t).
The four reflected waves at your position can be modeled as four poles in A( q −1 ) that locate at a distance
0.93 from the origin (inside but close to the unit circle) and at angles, 0.1 × 2π , –0.071 × 2π , 0.031 × 2π and
–0.051 × 2π radians, respectively. The variances of are σ w2 =0.01 and σ v2 =9.
In this task, we are going use the Kalman filter to predict the mobile radio channel in this situation.

What to do

Design a Kalman filter to predict a mobile radio channel tap from one-step to twenty-step. The channel tap
characterized by the above-mentioned AR process x(n) and its noisy measurement y(n) = x(n) + v(n) are
stored in data file ChannelPrediction.mat.
MATLAB is used to fulfill the task. The MATLAB codes to implement the Kalman prediction are,
currently, provided in file KalmanPredict_v3.m in the directory LabGUIv1.3/Work/Signalbehandling/.

10
Download the .m file onto the local harddisk, read it carefully, and try to understand how a Kalman filter
is implemented. The implementation in the .m file is conducted in the following procedure:
(i) load the data, ChannelPrediction.mat, which contains two 512-point time sequences: the channel tap
x(n) and the observation y(n). To validate xˆ ( n | n − m ) , the estimate and predict of x(n), the second 256
points (i.e., points 257:512) of x(n) are used.
(ii) create A, B, and C either in the controllable or observable canonical form for the state-space form,
x( n ) = Ax ( n − 1) + Bw( n ) (12a)
y (n ) = Cx ( n ) + v ( n ) (12b)
and the variance matrices of w(n) and v(n) are Q w = BB H σ w2 and Q v (n) = σ v2 , respectively.
(iii) create a MATLAB program, named KalmanGain.m, to calculate the Kalman gain K(n), and
investigate how the initial value P(0 | 0) affects K(n).
(iv) implement the recursive computation to find xˆ ( n | n ) ,
(v) find the m-step prediction using the relation
m −1
xˆ ( n + m | n ) = ∏ A xˆ ( n | n ) (13)
k =0

The calculations of the SNR in the observed signal y(n) and in the predicted signal xˆ ( n + m | n ) (or
equivalently xˆ ( n | n − m ) ) are done, respectively, in the following way
( ) (
SNR = 10 log10 σ x2 σ v2 = 10 log10 var( x ) σ v2 ) (14)
SNR( m) = 10 log10 ( x(n)
2
em ( n )
2
) (15)
where
em (n ) = x ( n ) − xˆ ( n | n − m) (16)

• What should be done is to work out A, B, C, Q w , Q v and x(n) correctly so that the program can get
through the implementation. The coefficients of the AR process with four poles, a(k) for k = 1, 2, 3, 4,
can be found from the command line AR=poly(0.93*exp(i*2*pi*[0.1 0.031 –0.051 –0.071])). Note
p
that a(k) are the coefficients in the polynomial of the form A( q −1 ) = 1 + a ( k )q − k .
k =1

In the report

(i) include the command lines for computing the Kalman gain K(n) and the plots of K(n) as function of
n=1~30 (real and imaginary parts in separate figures), calculated using two different initial values, i.e.,
P(0 | 0) = I, and 10000 I where I is an identity matrix; and give the steady-state values of K, e.g., at
n=30, and remark the influence of P(0 | 0) on calculating K(n).
(ii) include the command lines for the recursive calculation of xˆ ( n | n ) , and point out what initial values of
P(0 | 0) and x̂(0 | 0) are used.
(iii) give the SNR in the observed signal y(n) and in the estimated signal xˆ ( n | n ) , and tell how much the
SNR is increased after the Kalman filtering.
(iv) include the command lines for the m-step prediction and the SNR curve as a function of prediction step
from 0 to 20 (i.e., m=0 – 20); make comments on the SNR curve (e.g., why it behaves like this, etc.).

11
Appendix A. Mathematician Norbert Wiener (1894-1964)

Norbert Wiener was born on November 26, 1894, in Columbia, Missouri, and
received his Ph.D. in Mathematics from Harvard University at the age of 19
for a thesis on mathematical logic. Subsequently he studied under Bertrand
Russell in Cambridge, England, and David Hilbert in Göttingen, Germany. In
1919 he was hired by MIT as instructor of Mathematics, then as Assistant
Professor in 1929 and as Professor in 1931, and remained on faculty there
until 1960. During World War II, he worked on guided missile technology and
the feedback principle. He died in Stockholm in March 18, 1964.
Although he is most noted as "the father of cybernetics," he also made
many contributions to the fields of pure and applied mathematics, theoretical
physics and theoretical engineering. Wiener’s work also formed the basis for another new scientific field -
artificial intelligence - which amplified many of his theories on the relationship between man and machine in
its search to develop a machine that could think.
(www.digitalcentury.com/encyclo/update/wiener.html, and www-gap.dcs.st-and.ac.uk/Wiener_Norbert.html)

Appendix B. Mathematician Rudolf Emil Kalman (1930- )

Rudolf Emil Kalman was born in Budapest, Hungary, on May 19, 1930. He
received the bachelor's degree (S.B.) and the master's degree (S.M.) in electrical
engineering, from the Massachusetts Institute of Technology in 1953 and 1954
respectively. He received the doctorate degree (D. Sci.) from Columbia
University in 1957. He worked as Research Mathematician at Research Institute
for Advanced Study in Baltimore, between 1958-1964, Professor at Stanford
University between 1964-1971, and from 1971 to 1992 Graduate Research
Professor, and Director, at the Center for Mathematical System Theory,
University of Florida, Gainesville. Moreover, since 1973 he has also held the
chair for Mathematical System Theory at the ETH (Swiss Federal Institute of
Technology) Zurich. He is the recipient of numerous awards, including the IEEE Medal of Honor (1974), the
IEEE Centennial Medal (1984), the Kyoto Prize in High Technology from the Inamori foundation, Japan
(1985), the Steele Prize of the American Mathematical Society (1987), and the Bellman Prize (1997).
In 1960, R.E. Kalman published his famous paper, titled "A New Approach to Linear Filtering and
Prediction Problems", describing a recursive solution to the discrete-data linear filtering problem. And then
in 1961, Kalman and Richard Bucy published second paper, "New Results in Linear Filtering and Prediction
Theory." The two papers introduced a technique now widely known as Kalman filtering. Since that time, due
in large part to advances in digital computing, Kalman filtering (often also called Kalman-Bucy filtering) has
been the subject of extensive research and application, particularly in the areas of autonomous or assisted
navigation, signal processing and control theory.
The applications are endless. Kalman filtering has proved useful in navigational and guidance systems,
radar tracking, sonar ranging, and satellite orbit determination, to name just a few areas. Kalman and Bucy's
original papers have generated thousands of other papers on aspects and applications of filtering. Their work
has also stimulated mathematical research in such areas as numerical methods for linear algebra.
(www.cs.unc.edu/~welch/kalman/kalmanBiblio.html, and www.cs.unc.edu/~welch/kalman/siam_cipra.html)

12

You might also like