Digital Signal Processing ENGR 336
Coursework 2025
The purpose of this practical is to explore the fundamentals of digital signals processing using Matlab. Reading through the Matlab Tutorial on the moodle page is a prerequisite for the exercise. You are expected to write your own Matlab code, and appropriately comment it. The code will be assessed together the understanding of the code and the results demonstrated. Note marks will also consider clarity of presentation, labelling of graphs, etc. Your submission (in the form. of a report) should be submitted on Moodle by 12pm, Thursday 27th March 2025. You are expected to find appropriate on-line material to complement the information provided in the tutorial and lectures.
EXERCISE 1 SIGNAL GENERATION: (12 MARKS)
Write MATLAB code for the following functions and generate plots using the function stem(). Please refer to chapter 2 of the MATLAB tutorial to learn how to plot functions and a google search or the Matlab DSP reference https://uk.mathworks.com/help/pdf_doc/dsp/dsp_ref.pdf for more information on this specific stem() function. In your report, ensure that you fully comment your code. For each question (1.2, 1.3 & 1.4) you will receive 1 mark for the code 2 marks for demonstrating you understand how the code works (comments in the code and text explaining the function, plots and key features) and 1 mark for the presentation of the waveforms generated. Note question (a) is a practice waveform to get you started (not marked)
Generate and plot the following sequences using Matlab. Discuss in particular frequency content and choice of sampling frequency.
|
1.1
|
x[n] = sin(0.8πn + 0.8π)
|
|
1.2
|
x[n] = Re (ej πn/5) + Im(ej πn/10)
|
4
|
1.3
|
x[n] = 3 cos(1.3πn) − 4sin(0.5πn + 0.5π)
|
4
|
1.4
|
x[n] = 5 cos(1.5πn + 0.75π) + 4 cos(0.6πn) − sin(0.5πn)
|
4
|
EXERCISE 2: MANGNITUDE & PHASE: (12 MARKS)
The marking scheme for (2.1, 2.2 & 2.3) is the same as the above.
Generate and plot the magnitude and phase of the following functions using Matlab: hint: to plot more than 1 plot take a look at the “subplot” function
|
2.1
|
X[w] = jw/(1+jw) as a function ofw for -10π≤w≤10π
|
4
|
2.2
|
x(t) = Im(3-e(1-j2 π)t) as a function oft for -10≤t≤10
|
4
|
2.3
|
X(jw) = ej3w + ej5w as a function ofw for -10π≤w≤10π
|
4
|
EXERCISE 3: Z-DOMAIN (10 MARKS)
1 mark for each question will be for the code and 1 for the comments (that should clearly explain the function of the code). The additional 3 marks for each question will be for
1. What each pole and zero is telling us about the behaviour of the function
2. What the “factored” form. of the function is
3. Further information that can be extracted about the stability and performance of the function.
Determine the factored form of the following z-transforms and generate their pole-zero plots using Matlab. Hint: tf2zpk function
|
3.1
|
|
5
|
3.2
|
|
5
|
EXERCISE 4: SAMPLING & FILTERS (16 MARKS)
You may wish to wait until the “Discrete Fourier Transform” and Fast Fourier Transform (FFT) is covered in the lecture’s week 17 or 18 and work on these questions during the session in week 19.
However, to complete this exercise, only a basic understanding of the FFT is required, essentially that we can take a Fourier Transform. of a discrete function as well as a continuous function and that the FFT algorithm is a fast and efficient way to do this. In Matlab you will need to research the dedicated function FFT().
Marking scheme:
4.1: 1 mark for the code, 1 marks for the comments, 2 marks for the discussion
4.2: 3 marks for the discussion
4.3: 3 marks for the code, 4 marks for the design, 2 marks for the conclusions
4.1 Write a Matlab program to generate and plot, using the stem() function, 128 samples ofa cosine wave of frequency 8 kHz and amplitude 1 volt when sampled at a rate of 64 KHz. Use the FFT command to find the Fourier transform. of the sampled signal and then plot the magnitude spectrum versus frequency in Hz. Use the subplot command to plot the waveform in the upper and the spectrum in the lower part of the same figure window. Discuss your results. (Hint as above:
https://au.mathworks.com/help/matlab/ref/fft.html) [4]
4.2 Repeat the above using a frequency of 8.25 kHz and compare your results with those obtained in (4.1) above. Discuss your results and explain any difference between those of (4.1) and (4.2). [3]
4.3 Design a filter (without using the ‘fir1 function) so that the filter passes only the low frequency component of combined cosine waves at frequencies of 4 kHz and 24 kHz or if you wish from 1.3 or 1.4 above. Plot the magnitude and phase spectra and compare it against the same design using the ‘fir1’ function. Discuss your results. Note you are free to use any filter design method you wish (ref. lectures or background reading) [9]