# ECE 445S Real-Time Digital Signal Processing Lab - Homework 5 Hints

Homework #5: Assignment in Word and PDF formats.
• A Hamming window is an even symmetric pulse about the midpoint with endpoints having value 0.08. The Matlab command for the Hamming window is `hamming`. The amplitude values of the causal Hamming window of length N samples is defined as
```w[n] = 0.54 - 0.46 cos(2 pi n / (N - 1))
```
for n = 0, 1, ..., N-1.

The group delay of a Hamming pulse of length N samples is (N-1)/2 samples.

• Please keep all of the work for each problem together. This will make it easier for the grader to grade them and hence assign appropriate partial or full credit for problems.

• "Random Modeling", Simon Haykin, excerpts from chapter 4 of his book Communication Systems, 3rd edition.
• 4.6 Random Processes,
• 4.8 Mean, Correlation and Covariance,
• 4.9 Ergodicity,
• 4.10 Transmission of a Random Process Through a Linear Filter,
• 4.11 Power Spectral Density, and
• 4.12 Gaussian Process.
The handout is only available on Canvas.

• Problem 5.1: This problem serves as an introduction to using steepest descent methods to find an optimum answer through numerical calculations. Steepest descent methods lie at the heart of many adaptive algorithms in channel equalizers, echo cancellers, automatic gain control, sampling time/offset correction, phase lock loops, etc. Previous midterm #2 exams have adaptive algorithm questions based on steepest descent:

More on applications for adaptive algorithms on homework assignments 6 and 7.

The basic idea of steepest descent is illustrated on Figure 6.15 at the top of page 116 in JSK. We are trying to find the value x* that is the minimum for a cost/objective function J(x) by updating x at each iteration so that we make progress toward the minimum value. The minimum value will be reached when J'(x*) = 0. If our current value for x > x*, then we want to decrease x. If our current value for x < x*, then we want to increase x. The update equation for iteration k+1 to realize these goals is shown in JSK (6.5):

```                    d      |
x[k+1] = x[k] - mu -- J(x) |
dx      |
x = x[k]
```
Here, mu is a constant positive value that controls by how much x is updated in each iteration. Generally, mu is kept small, e.g. 0.1 or 0.01 or even 0.001. When mu is zero, no update to the initial guess is made during the iterations. When J'(x[k]) = 0, the minimum value of the objective function is reached, and x[k+1] = x[k].

The choice of mu has an analogy with the location of a single real-valued pole in a discrete-time LTI system. Consider using a squared distance for J(x), e.g. J(x) = x2. Then, J'(x) = 2 x and

```x[k+1] = x[k] - mu (2 x[k]) = (1 - 2 mu) x[k]
```
This is a recursive difference equation with a pole at 1 - 2 mu. When mu = 0, the pole is at location 1, which is BIBO unstable. When mu = 1, the pole is at location -1, which is also BIBO unstable. The update is BIBO stable when 0 < mu < 1.

The error surface is "basically a plot of the objective as a function of the variable that is being optimized" (JSK page 118). Examples of error surfaces are in Fig. 6.17 on JSK page 119.

In this problem, the objective function is of the form J(x) = (x - C)2 which has a global minimum at x = C.

Problem 2.1 on spring 2016 midterm #2 might be helpful in solving this problem.

Marker board explanation of this problem from spring 2020 might also be helpful.

• Problem 5.2: This problem uses 4-PAM encoding, i.e. 2 bits per symbol. The message to be sent is a string of ASCII characters. Since each ASCII character is eight bits, each ASCII character will correspond to four two-bit symbols.

The problem is based on the code in idsys.m. In idsys.m, parameter l is set to 125. Page 172 of Software Defined Radio has the following explanation: "The initial delay of 125 corresponds to half the length of the lowpass filter (0.5*fl) plus half the length of the correlator filter (0.5*M) plus half a symbol period (0.5*M), which accounts for the delay from the start of each pulse to its peak."

Correction: The parameter l is the delay in samples through the transmitter and receiver in Fig. 9.1 on page 166 in JSK. The transmitter has a pulse shaping filter of length M samples, which has a group delay of (M-1)/2 samples. The receiver has a lowpass demodulating filter, which is a linear phase finite impulse response filter with a group delay of f1/2 samples because f1 is the filter order. The receiver also has a pulse correlator filter (a.k.a. matched filter) of M samples, which has a group delay of (M-1)/2 samples. Assuming that the receiver is synchronized with the transmitter with respect to symbol timing, the total delay l is 0.5*f1 + M - 1 samples. The book has 0.5*f1 + M.

In analyzing the results, it might be helpful to analyze the sequence of processing steps in the transmitter and receiver in idsys.m in the discrete-time frequency domain as follows.

The parameter M controls the number of samples per symbol. Hence, the duration of the discrete-time pulse shape is M samples.

In continuous time, the wider the pulse, the narrower the bandwidth. For example, a rectangular pulse of T seconds in duration has a null bandwidth of 1/T in Hz or 2 pi / T in rad/s, as seen in homework problem 0.1. A similar insight holds in discrete time. For example, a rectangular pulse of N samples in duration has a null bandwidth of 2 pi / N in rad/sample.

The Matlab simulation is in discrete time. The discrete-time index is implied in the Matlab code

```t= 1/M : 1/M : length(x)/M;
```
which can be rewritten as
```n = 1 : length(x);
t = n / M;
```
M is both the number of samples per symbol and the sampling rate.
```c(t) = cos(2 pi fc t)
```
Letting t = n / M,
```c[n] = cos(2 pi (fc / M) n)
```
To prevent aliasing, M > 2 fmax where fmax = 2 fc + 2, as described in the next paragraph. With M = 100, having fc < 24 would prevent aliasing. In idsys.m, fc = 20.

For the communication system in idsys.m, it might help to draw the key signals in the continuous-time Fourier domain: transmitter baseband signal, transmitted modulated signal, received modulated signal and received baseband signal. Assume that the sampling rate fs is chosen such that fs > 2 fmax where fmax = (2 fc + 2) and only plot frequencies from -fs/2 to fs/2. In idsys.m, fs = M.

• Transmitter
• Baseband signal is a triangle from -2 Hz to 2 Hz. Baseband bandwidth is 2 Hz.
• Sinusoidal modulation by a cosine at frequency fc. This gives two bands:
• Band #1: (-fc - 2) to (-fc + 2)
• Band #2: (fc - 2) to (fc + 2)
There is overlap between the bands when fc < 2. Maximum frequency is (fc + 2) Hz.
• Sinusoidal modulation by a cosine at frequency fc. This gives three bands:
• Band #1: (-2 fc - 2) to (-2 fc + 2)
• Band #2: -2 to 2
• Band #3: (2 fc - 2) to (2 fc + 2)
There is overlap between the bands when fc < 2. Maximum frequency is (2 fc + 2) Hz.
• Matched filter that passes frequencies from -2 Hz to 2 Hz. Has gain of 2 to offset loss of gain when sinusoidal amplitude modulation yields bandpass transmission with no overlap in bands.

• Problem 5.3: Chalkboard notes on number of multiplications and memory reads per second, part 1 and part 2.

All polyphase filters see the same input signal a[n], which is a stream of symbol amplitudes. Part 3 illustrates a polyphase filter bank sharing one delay line, which stores the current and previous Ng symbol amplitudes, instead of each polyphase filter having its own identical delay line.

Last updated 04/03/24. Send comments to bevans@ece.utexas.edu