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

Homework #0: Assignment in Word and PDF formats.

• Convolution review

• Fourier transform review

• For the names of Matlab functions for common signals, please see Common Signals in Matlab:
• even symmetric rectangular pulse rect(t) for t in [-1/2, 1/2]: `rectpuls(t)`
• even symmetric triangular pulse tri(t) for t in [-1, 1]: `tripuls(0.5*t)`
• step function u(t) with u(0) = 1: `(t >= 0)`
• sinc pulse sinc(t) = sin(pi t) / (pi t): `sinc(t)`

If your Matlab version does not have the `rectpuls` command, then you could define it by creating a file called `rectpuls.m` with the following contents

```function y = rectpuls(t)
y = (t >= -0.5) & (t < 0.5);
```

and then put the file `rectpuls.m` on the MATLAB search path. You can find the directories on the MATLAB path by evaluating

```path
```
You can add `directory` to the MATLAB path by evaluating
```path(path, directory);
```
The directory should be surrounded by single quotes.

• Please keep all of the work for each problem together. This makes it much easier for the grader to give you the appropriate full or partial credit due for the solution.

• Problem 0.1. There are two common definitions of the Fourier transform for continuous-time signals. In this problem, I am asking you to work the answers in frequency w in units of rad/s because that's the version of the Fourier transform you had seen in your signals and systems course. The other common form of the continuous-time Fourier transform uses frequency f that is in units of Hz. If you work the problem using the continuous-time Fourier transform in Hz, then convert your answer to w in rad/s.

Here's much of the problem worked out on a marker board using frequencies in Hertz. More information below on different parts of the problem.

• Problem 0.1(a). Please see the above note for problem 0.1.

Here is a key Fourier transform property for this part:

```
1
F { x(t) h(t) } = ---- X(w) * H(w)
2 pi
```
That is, multiplication in the time domain is convolution in the frequency domain. The scaling factor of 1/(2 pi) is due to the fact that w = 2 pi f. See the handout on Continuous-Time Fourier Transforms in w and f.

Another property that you might need for this problem is that

```              / oo
|
x(t) * d(t) = | x(v) d(t - v) dv = x(t)
|
/ -oo
```
where d(t) is the Dirac delta functional. This is due to the sifting property of the Dirac delta (see lecture slides 3-5 and 3-6). Likewise,
```                   / oo
|
x(t) * d(t - t0) = | x(v) d(t - t0 - v) dv = x(t - t0)
|
/ -oo
```

• Problem 0.1(b). The Fourier transform will be of the form
```C(w) = F(w) + G(w)
```
To sketch the magnitude response by hand, you can use the following inequality:
```| C(w) | = | F(w) + G(w) | ≤ | F(w) | + | G(w) |
```
The inequality decouples the plotting of | F(w) | and | G(w) |.

For the hand sketch, you could draw the spectrum without using a specific numeric value for fc in mind, although fc would have to be larger than the bandwidth of the lowpass signal prior to modulation to get a bandpass spectrum.

When plotting the magnitude response by computer, I'd recommend plotting in f (Hz). That will help you to become more accustomed to the Fourier transform in f, which we'll be using in this course. You can either start in the time domain (with part (a)) or in the frequency domain (with the Fourier transform derived earlier in part (b)). If you start in the time domain, then the MATLAB command `plotspec` command may be helpful. The `plotspec` command is defined in `plotspec.m` that comes with the Software Receiver Design book.

• Problem 0.1(c). Bandwidth is defined as the non-zero extent of the magnitude of the frequency response in positive frequencies. The difficulty is in quantifying non-zero extent. Common ways for quantifying non-zero extent are on lecture 1 slides. The simplest method is to eyeball the bandwidth based on the plot of the magnitude of the Fourier transform given by the `plotspec` function in Matlab.

To plot the continuous-time signal, you'll need to choose a sampling rate fs. From the sampling theorem, fs > 2 fmax.

• Problem 0.3. Please see Section 7.1 in Oppenheim & Willsky's Signals and Systems book, Sections 8.1-8.4 in Lathi's Linear Systems and Signals book, or Sections 4-1, 4-2, and 4-5 in McClellan, Schafer & Yoder's Signal Processing First book. Other signals and systems textbooks should have similar material in them. Also, see slides 1-18 and 1-19 in this semester's Generating Sinusoidal Signals Slides. The Fourier series for the impulse train is derived on EE 313 Final Exam Fall 2021 Question 2

• Problem 0.4(a). Block diagrams for discrete-time systems are covered in Section 10.8 in Oppenheim & Willsky, Section 5.4 in Lathi, and Sections 5-4 and 8-9 in McClellan, Schafer & Yoder. In your block diagram, as mentioned on the homework assignment, please use a block with z-1 inside to represent a delay of one sample. Here, z-1 represents the transfer function in the z-domain for a linear time-invariant system that delays its input by one sample. Lecture 5 slides may also be of help.

• Problem 0.4(b). The initial conditions for a system refer the values in the system's memory due to inputs and outputs that occurred prior to the time that the system is observed. We generally set the observation time to zero. For discrete-time systems, y[0] is not an initial value, whereas for continuous-time systems, y(0) is an initial value. In the problem, w0 is a constant and not an initial condition.

You are given a difference equation of the form

y[n] = a1 y[n-1] + a2 y[n-2] + b0 x[n] + b1 x[n-1]

The introduction of the problem says that the impulse response of the linear time-invariant system is a causal sinusoid. So, for input x[n] = d[n] where d[n] is the discrete-time impulse, the output is

cos(w0 n + phi) u[n]
where phi is a constant.

For a causal system, the current output value depends only on previous output values, and current and previous input values.

Since the system is causal, we can start the observation of the system at n = 0, and let time advance to n = 1, n = 2, etc. to determine what the initial conditions are. For n = 0,

y[0] = a1 y[-1] + a2 y[-2] + b0 x[0] + b1 x[-1]

In order for a system to be linear and time-invariant, it must be at rest. At rest, in the case, means that the initial conditions must be zero.

Generating Sinusoidal Signals slides 1-22 and 1-23 might also be of help here.

• Problem 0.4(c). See Lecture 5 slide 5-10 for an introduction to z-transforms including computing the region of convergence, and See Lecture 5 slide 5-11 on visualizing regions of convergence in the complex z plane.

• Problem 0.4(e). The formula for the impulse response will include a discrete-time unit step term u[n] which has value 1 when n >= 0 and 0 otherwise. The MATLAB function `heaviside` isn't quite what we need because it has a value of 0.5 at the origin. We can generate our own using the > operator in MATLAB. This operator returns 0 for false and 1 for true. We can implement u[n] as n >= 0:
```n = -5:5;
uofn = ( n >= 0 );
stem(n, uofn)
```

Once you have generated a plot in MATLAB, you can export the plot to another program for editing such as to shrink the plot to save paper. In the Matlab plot window, first select the Edit menu, then select the "Copy Figure" option, and finally paste the plot into a word processing program for editing. You can also save the plot as a PNG file and then import it into your Word document.

Last updated 09/12/24. Send comments to bevans@ece.utexas.edu