ES3C5 2023-2024 lab data v2
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
1 General Instructions
Heads up regarding names: These instructions include precise case-sensitive guidance regarding names of files, directories, functions, and variables. These must be followed exactly so that the marking scripts run correctly. There will be marks deducted for any deviations. Precise naming is standard practice in programming to ensure integration.
The instructions to complete this lab assignment areas follows:
1. Download the zip file ES3C5_2023_2024_lab_data_v2_1.zip (link)from the ES3C5 Moodle
Page under the Assessment Information heading. Extract four files from the zip file:
(a) ES3C5_2023_2024_lab_template.m
(b) ES3C5_2023_2024_lab_template.docx
(c) u
(d) ES3C5_2023_2024_lab_recording_v1_1.pdf
where
2. Download your signals file u
Note: This is a separate download so that you do not need to download everyone else’s signals (over 100MB).
3. Rename the template files as follows:
ES3C5_2023_2024_lab_template.m to u
ES3C5_2023_2024_lab_template.docx to u
4. Open u
ES3C5_2023_2024_lab_template() to u
5. Completethe prescribed steps in the Recording Supplement
(ES3C5_2023_2024_lab_recording_v1_1.pdf) to record the audio data that you will use to answer the problems in Question 1. This data will be stored to the file u
6. Complete the problems listed below in Section 6 and refer to u
7. When a question includes plotting a figure, please account for the following:
(a) Always start by creating a new blank figure. Do not close or overwrite existing figures.
(b) The plot function calls must be inside the question subfunction code.
(c) Carefully consider appropriate parameter ranges to view all necessary detail.
(d) ALL submitted plots must have labelled axes. You can add labels after your code runs.
(e) Any data point label should include the parameter name, value, and units.
(f) Figures must include your student number and question number at the top.
(g) ALL submitted plots must be placedinu
8. Include readable comments in your code that briefly summarise your work, especially critical steps. See the subfunction Q0 in u
9. Run your code file from the MATLAB command line and write the output to a structure named Answers. Save Answers to amat filenamed u
Answers = u
save(’u
10. Place all necessary files into 1 folder named u
Be sure to place the files into the named folder before zipping. This ensures that your code is nested in its own subdirectory when unzipping.
2 Recording Supplement
Refer to ES3C5_2023_2024_lab_recording.pdf for instructions on recording and saving audio.
2.1 Specification of the Data to Record
The (imaginary) premise is that the University has decided to add voice codes as an option in two-factor authentication, so you can state the last 4 digits of your student number in order to access University systems. You will record your voice saying the last four digits of your student number. This recording must be recorded to a single channel (mono) at a sampling frequency of 22.05kHz and must be exactly 3 seconds long. If the original recording is longer than 3 seconds, then you must shorten it to 3 seconds before saving to u
3 Questions (Total: 100 Marks)
Please answer all of the following questions with reference to u
25 marks are designated as being part of “First Class Problems”. These questions are deliberately more challenging. The instructors and lab demonstrators will not provide guidance on how to answer them. Clarifications can be made regarding what these questions are asking.
Up to 30 Marks in total can be deducted for poor coding style. Poor style includes:
Writing output to the command line (e.g., by omitting semi-colons for output suppression)
Insufficient use of code comments to explain key steps and demonstrate your understanding of your implementation. However, succinctness is still appreciated.
Here are the questions:
1. (30 Marks) This question concerns audio generation and processing. Please complete the following:
(a) (4 marks) Complete the appropriate steps in the recording guidance and save your audio recording vector with the correct specification to the file u
Note: There is nothing to calculate here; this part is being evaluated by the correctness ofyour audio and loading it into the a1 subfunction.
(b) (6 marks) Your recording has become contaminated by a noise source. The contents
of the noise source are in the vector n1 in your signals file u
i. Add the noise source vector n1 to your audio signal Q1.audioRaw. Assign the noisy signal to Q1.audioNoisy.
ii. Calculate the fast Fourier transform (FFT) of Q1.audioNoisy. Do not apply scaling. Assign the FFT to vector Q1.FFT.
See the Extra box 14.2 “Double-Sided vs Single-Sided FFT” in the lecture notes to be aware that the MATLAB help examples present the FFT different from how you should calculate it. You must find the double-sided FFT (which we cover) and not the single-sided FFT (which we do not cover). iii. Plot the magnitude of this FFT output as a function of Hz frequency (i.e., a domain of [0,22050)Hz should be visible). Include a label for the largest noise frequency component. Save the FFT magnitude plot as a png file and include it in u
(c) (12 marks; “First Class Problem”) Design an FIR filter to isolate (i.e., primarily output only) the largest noise frequency component.
i. In no more than 4 lines of text in u
ii. Design a filter that meets your target specification. Assign the filter impulse response to Q1.h.
iii. Plot the frequency response of your design. You must use freqz as the plotting function. Use sufficient labels to verify your design. Save the plot as a png file and include it in u
iv. Briefly (in no more than 2 lines of text) explain in u
v. Test your filter design. Pass your noisy audio signal Q1.audioNoisy through your designed filter using the filter function. Assign the filtered output to Q1.audioNoiseIsolated.
(d) (8 marks) You wish to make your voice recording sound more interesting. Consider applying aflanging effect that adds a time-varying delay. You will use aflanging filter with the following time-domain difference equation:
y[n] = x[n] + Ax[n − 0.5B + 0.5B cos[2πfn]],
where A is the strength of the flange, B is the longest delay (measured in samples), and the frequency f (measured in cycles/sample) refers to the speed of the delay change. Complete the following:
i. Using the flange strength A1, the longest delay B1, the flange frequency f1 (in cycles/sample), and the time-domain difference equation in a for-loop, pass your original audio signal Q1.audioRaw (not the noisy audio or isolated noise) through the flanger. Ensure that the output has the same length as the input. Assign the flanging output to Q1.audioFlange.
Hint: The index variable must be a positive integer.
Hint: Assign the output a value of 0 for values of n where x[n − 0.5B + 0.5B cos[2πfn]] is outside the indexable range of x[n].
ii. Briefly (in no more than 2 lines of text) comment in u
2. (30 Marks) This question concerns interference and aliasing.
You are an engineer at SpaceZ and are receiving signals from the new deep space satellite deployed by SpaceY. You are tuning your terrestrial hardware using transmissions from the satellite and have collected a sequence of time-series data that was sampled at frequency f2s. The collected data is in the vector y2 in your signals file u
(a) (9 marks) Design an FIR low pass digital filter for the satellite signal with the windowing method. Complete the following:
i. Using the window information tables in the lecture slides or notes, determine the shortest window type and length that will give a pass band ripple parameter below rp dB at frequencies less than fb, and that has a stop band defined by frequencies above fstop2. Remember that the sampling rate being used is f2s. Assign window type as a case-sensitive character array (either ’rectwin’, ’hann’, ’hamming’, or ’blackman’) to Q2.w. Assign window length L to Q2.L. Note: You can assume that the tables are accurate.
ii. Use the fir1 function and the corresponding window function to determine the unscaled impulse response h[n]. Use a cutoff frequency that is exactly halfway between fb and fstop2. Assign FIR impulse response vector h[n] to Q2.h.
iii. Use your FIR low pass digital filter with the filter function (and not any function variant). Assign the low pass filter output to Q2.yLow.
(b) (12 marks) Determine the spectra associated with Q2.yLow as follows:
i. Calculate the double-sided fast Fourier transform (FFT) of Q2.yLow. Do not apply scaling. Assign the FFT output to vector Q2.FFT.
ii. Each element in the FFT is associated with a frequency. Create the vector of frequencies associated with Q2.FFT. Assign the vector of frequencies to Q2.fRange.
iii. Plot the magnitude of Q2.FFT as a function of Hz frequency (i.e., a domain of [0,f2s)Hz should be visible). For all periodic components with actual frequencies up to fb, label all corresponding spectral peaks with the true component frequencies. You should assume that there is no aliasing. Save the FFT magnitude plot as a png file and include it in u
(c) (9 marks; “First Class Problem”) Suppose that one of the spectral peaks identified in Question 2(b) could bean alias (i.e., ignore the fact that Q2.yLow is the output of a lowpass filter). Complete the following:
i. Calculate the lowest frequency signal (in Hz and rounded to the nearest Hz) that could lead to one of the spectral peaks as an alias. Briefly (in no more than 3 lines of text) explain your approach in u
ii. Create a signal with frequency Q2.fAlias and plot its FFT to demonstrate that it would result in the alias as predicted. Label all corresponding spectral peaks.
Save the FFT magnitude plot as a png file and include it in u
3. (20 Marks) This question concerns estimation of an unknown signal.
You area control engineering consultant and are visiting the factory of NewWave Mobile to inspect a heating chamber that will be used to stress-test their new drone communication chips. Based on the chamber specification, you expect that the transient heating profile will behave according to the general equation provided in u
You have collected noisy thermometer readings in column vector y3 in your signals file u
(a) (3 marks) Construct the linear model observation matrix Θ needed to estimate the unknown parameters A3, B3, and C3 (in that respective order). Assign Θ to Q3.Obs.
(b) (2 marks) Apply linear model estimation to estimate the unknown parameters A3, B3, and C3. Assign these three constants in the same order to the 3 × 1 column vector Q3.param.
(c) (1 mark) Use the parameter estimates to predict the temperature for the same times at which the sensor values were taken. Assign the predicted temperatures to column vector Q3.yHat.
(d) (1 mark) Calculate the mean square error of the predicted temperatures. Assign the scalar mean square error to Q3.mse.
(e) (13 marks) Compare the spectra of the temperature sensor readings with those of the estimated temperatures, as follows:
i. Calculate the double-sided fast Fourier transform (FFT) of y3. Assign the FFT output to vector Q3.yFFT.
ii. Each element in the FFT is associated with a frequency. Create the vector of frequencies associated with Q3.FFT. Assign the vector of frequencies to Q3.fRange.
iii. Calculate the fast Fourier transform (FFT) of Q3.yHat. Assign the FFT output to vector Q3.yHatFFT.
iv. Plot the magnitude of both FFT outputs as a function of Hz frequency (i.e., a domain of [0,1/Ts3)Hz should be visible). Include both sets of spectra on the same axes. Label all relevant spectral peaks. Save the FFT magnitude plot as a png file and include it in u
v. In no more than 5 lines of text, comment in u
the model. Would a time-domain plot be helpful to verify the accuracy?
4. (20 Marks) This question concerns the estimation of FIR filter coefficients.
You work for NewWave Mobile and you are performing wireless propagation testing in Coventry where a new 5G base station will be installed. Since there are many cloudy days, you are measuring the impact of signal reflections when the base station is communicating with a mobile user. You have determined that there are four primary signal paths of interest: the direct path from the base station and three paths that reflect off of the clouds. The reflections arrive later than the direct signal, such that the total received signal voltage y4[n] is the output of a noisy difference equation of the form provided in u
You have collected samples of the received signal voltage (in Volts) y4[n] based on the transmission of a pseudo-random pilot sequence x4[n]. These are given as the column
vectors y4 and x4, respectively, in your signals file u
(a) (4 marks) Construct the linear model 4-column observation matrix Θ needed to estimate the unknown FIR filter coefficients A4, B4, C4, and D4 (in that respective order). Assign the 4-column Θ matrix to Q4.Obs.
(b) (6 marks) There was a sensor malfunction in your recording equipment while measuring y4[n], such that the variance of w4[n] gradually increased by a constant multiplicative factor of k4 for each of the last s4 samples (as described in u
(c) (2 marks) Apply linear model estimation (using weighted least squares) to estimate the FIR filter coefficients A4, B4, C4, and D4. Assign these four constants in the same order to the 4 × 1 column vector Q4.param.
(d) (1 mark) Use the FIR filter coefficient estimates to predict the voltage for the same pilot input sequence x4[n]. Assign the predicted voltages to column vector Q4.yHat.
(e) (3 marks) Compare the measured voltages and predicted values in the time domain on the same axes in a single time-domain plot, where the x-axis is the sequence index and the y-axis is the voltage. Save the plot as a png file and include it in u
(f) (4 marks; “First Class Problem”) Suppose that the specified multiplicative factor k4 was measured incorrectly. Assuming that predicted voltage signal Q4.yHat is the correct noiseless signal, consider estimating the correct value of k4. In no more than 4 lines of text, propose an approach in u
4 Submission of Deliverables
Place your files into a folder named u
1. u
2. u
3. u
4. u
5. u
Be sure that u
You must submit the zip-file to Tabula. It is your responsibility to double-check your submission after it is uploaded to ensure that the correct files were included. You may refer to the Wrong File Upload Policyas published by the ESO.
Your assignment must be submitted by 12pm (noon) on Thursday 30 November 2023, otherwise standard late penalties will be applied. Applications for extension without penalty must be made via Tabula.
5 Notes on Marking
Each problem will be marked according to:
Correctness of the audio recordings. Your submitted code must not play any audio.
Correctness of the calculated answers, figure contents, and written answers.
– Incorrect answers will not automatically penalise you in later problems.
– Written answers will not be read beyond the number of lines specified in the question. A line of math will be read as 1 line.
Implementation of the code used to arrive at your answers. All relevant calculations should be performed within your code.
Presentation of labelled plots. Take care that plots include all information requested, including your student number and the question number in every figure title.
Code running efficiently as expected by the marking scripts. This includes using correct naming, correct directory structure, and your code running without errors. Expect that any lines of code causing an error will be commented out and then the rest of the code executed “as is”.
Common reasons for “execution” errors:
Trying to use a MATLAB toolbox that we do not introduce in the module.
Trying to read from a parameter before it has been created.
Making changes to the format of the output argument structure.
2023-11-30