EE345S Real-Time Digital Signal Processing Lab - Homework

- Homework #4:
Assignment in
PDF format.
- Homework #3:
Assignment in
PDF format.
- Problem 3.3: This problem asks you to evaluate four ways
to filter an input signal.
Some of the methods yield a linear convolution, and some do not. With an input signal of 24 samples in length and a filter with an impulse response of 16 samples in length, the linear convolution would be 39 samples in length (i.e., 24 + 16 - 1).

For the FFT-based method, the length of the FFT determines the length of the filtered result. An FFT length of less than 39 would yield a convolution, but it wouldn't be linear convolution. Convolution computed using the FFT is called circular convolution. When the FFT length is long enough, the answer computed by circular convolution is the same as by linear convolution.

Consider the case when the filter is a block in a block diagram, as would be found in Simulink or LabVIEW. When executing, the filter block would take in one sample from the input and produce one sample on the output. How would the scheduler know how many times to execute the block? As many times as there are samples on the input arc. How many samples would be produced? As many times as the block would be executed.

- Problem 3.3: This problem asks you to evaluate four ways
to filter an input signal.
- Homework #2:
Assignment in
PDF format.
- Matlab:
There is a handout in the course reader on
Matlab in Appendix D that may be helpful.
In the CD ROM, the file
`freqresp.m`

will implement the Matlab function`freqresp`

. Please put these .m files on your path. A convenient place is the current working directory. The following Matlab commands may be useful:`cd`

: change directories (without an argument, it prints the working directory)`dir`

: lists the contents of the current working directory`pwd`

: prints working directory

- Problem 2.1:
For the magnitude response, poles near the unit circle indicate
the passband of the filter, and zeros near or on the unit circle
indicate the stopband.
Poles on the unit circle correspond to a pure oscillator.
In the cases for which one cannot find the frequency response by simply substituting

*z*= exp(*j**w*), one can use the discrete-time Fourier transform (see slide 5-8). Using the discrete-time Fourier transform may require you to search in other books, e.g.*Discrete-Time Signal Processing*by A. V. Oppenheim and R. W. Schafer. Another option is to use Mathematica to compute the discrete-time Fourier transform for the discrete-time signal. To run Mathematica, login to sunfire1 or sunfire2 and type "math", and then cut-and-paste the following commands to find the discrete-time Fourier transform for problem 2.1(d):AppendTo[ $Path, "/home/ecelrc/faculty/bevans" ]; Needs[ "SignalProcessing`Master`" ]; First[ DiscreteTimeFourierTransform[ Cos[w0 n] DiscreteStep[n], n, w ] ]

For problem 2.1(c),First[ DiscreteTimeFourierTransform[ DiscreteStep[n], n, w ] ]

- Problem 2.4:
In part (b), the filter order will be somewhat low for the given
filter specifications.
To see the difference among the IIR filter design methods,
narrow the transition region (i.e. increase the passband frequency
and decrease the stopband frequency) but don't worry about the
designed filter meeting the original specification.
For digital IIR filters, the filter order is inversely proportional
to the width of the transition region.
The Matlab command

`filtdemo`

will provide a graphical user interface for designing filters. The filtdemo requires seven parameters: filter design method, maximum passband frequency, passband magnitude tolerance, minimum stopband frequency, stopband magnitude tolerance, sampling rate, and filter order. The statement of problem 2.4 gives the filter design parameters to use in`filtdemo`

.In order to run Matlab remotely, run X windows on your local machine, login into sunapp1.ece.utexas.edu or sunapp2.ece.utexas.edu, using secure shell (ssh) and then run Matlab:

matlab &

If Matlab will not run due to an improper DISPLAY variable, then run the following on either sunapp machine:source ~bevans/setd

There are many X windows emulators for PCs and Macs, including- PCs: Xwin32

- Matlab:
There is a handout in the course reader on
Matlab in Appendix D that may be helpful.
In the CD ROM, the file
- Homework #1:
Assignment in
PDF.
- Problem 1.1(d):
In part (d), an oscillator can be realized by a
second-order difference equation.
Please see the solution to Problem 1.1 on Midterm #1 in Spring 2004,
which is slide K-29 in the appendix of the course reader.
(Tradeoffs among three sinusoid generation methods is the
subject of Problem 1.2 on Midterm #1 in Fall 2003, which is
on slide K-25 of the reader.)
- Problem 1.3: There is a handout in the course reader on
Matlab in Appendix D that may be helpful.
In the CD ROM, the file
`specnoise.m`

will implement the Matlab function`specnoise`

. Place the file`specnoise.m`

on the Matlab path. A convenient place is the current working directory. The following Matlab commands may be useful:`cd`

: change directories (without an argument, it prints the working directory)`dir`

: lists the contents of the current working directory`pwd`

: prints working directory

- Problem 1.5(a):
The Matlab command
`filtdemo`

will provide a graphical user interface for designing filters. The filtdemo requires seven parameters:- filter design method,
- maximum passband frequency in Hz,
- passband magnitude tolerance in dB,
- minimum stopband frequency in Hz,
- stopband magnitude tolerance in dB,
- sampling rate in Hz, and
- filter order.

`filtdemo`

.Be sure to check the graphical view of the passband and stopband to make sure that each of the three filter designs meets specifications. If you are not absolutely sure, then you can compute the magnitude response is at a particular frequency using the

`freqz`

function in Matlab. The arguments are the filter transfer function (type`help filtdemo`

to find out how to obtain the transfer function of the current design) and the frequency in Hz. Then, you can take the magnitude of the result. Finally, you'll need to convert the magnitude to dB using 20 log_{10}magnitude. For more information on`freqz`

, type`help freqz`

in Matlab.In order to run Matlab remotely, run X windows on your local machine, login into sunapp1.ece.utexas.edu or sunapp2.ece.utexas.edu, and then run Matlab:

matlab &

If Matlab will not run due to an improper DISPLAY variable, then run the following on sunapp1:source ~bevans/setd

There are a variety of X windows emulators, including- Xwin32
- X-Deep/32: similar to Xwin32. Written by an Austin programmer.
- Cygwin/X: uses Cygwin and X.org software to install an entire POSIX-compatible layer in Windows, so it's a little more complicated to setup.

- Problem 1.5(d):
The FIR coefficients designed by the Remez exchange,
FIR least squares, and Kaiser window methods have even
symmetry about the midpoint.
Some DSPs have accelerator instructions to take advantage
of the symmetry in the coefficients.
Most do not.
The C6000 families do not.
You do not have to write any assembly language code for this problem. To compute one output sample of an FIR filter, one needs to compute the vector dot product of the vector of FIR coefficients and the vector of the current and the previous

*N*- 1 input values. In lecture 1, we discussed the rough outline of an assembly function to compute one output value of an FIR filter:- Prolog: initialize accumulator, initialize modulo indexing, and
initialize downcounter register with value
*N* - Loop: compute the vector dot product, which entails reading coefficients and input data values from on-chip memory, multiplication, addition, and decrementing the downcounter
- Epilog: return output value

- Prolog: initialize accumulator, initialize modulo indexing, and
initialize downcounter register with value

- Problem 1.1(d):
In part (d), an oscillator can be realized by a
second-order difference equation.
Please see the solution to Problem 1.1 on Midterm #1 in Spring 2004,
which is slide K-29 in the appendix of the course reader.
(Tradeoffs among three sinusoid generation methods is the
subject of Problem 1.2 on Midterm #1 in Fall 2003, which is
on slide K-25 of the reader.)