联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Matlab编程Matlab编程

日期:2023-11-30 11:03

(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<ID>_lab_Audio.mat. It is needed to proceed with Question 1. Load the recording

into the Q1 subfunction. The subfunction has template code that you just need to

update.

? Note: There is nothing to calculate here; this part is being evaluated by the

correctness of your audio and loading it into the Q1 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<ID>_lab_signals.mat.

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<ID>_lab.docx.

(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<ID>_lab.docx, describe and justify a target

FIR filter performance specification. The specification should be sufficient to

assess a candidate design by inspection of the magnitude of the filter’s frequency

response. Consider practical values for the band gains and frequencies.

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<ID>_lab.docx.

iv. Briefly (in no more than 2 lines of text) explain in u<ID>_lab.docx whether

your plot validates the design.

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 a flanging effect that adds a time-varying delay. You will use a flanging

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

8

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<ID>_lab.docx on how

the output sounds.

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<ID>_lab_signals.mat. You are expecting to observe a periodic signal from the satellite with frequency components up to frequency fb. Please complete the following:

(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<ID>_lab.docx.

(c) (9 marks; “First Class Problem”) Suppose that one of the spectral peaks identified

in Question 2(b) could be an 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<ID>_lab.docx. Assign this frequency

(in Hz) to Q2.fAlias.

9

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<ID>_lab.docx.

3. (20 Marks) This question concerns estimation of an unknown signal.

You are a 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<ID>_lab.txt

where y3(t) is the temperature in degrees Celsius and w3(t) is the noise signal at time

t in seconds.

You have collected noisy thermometer readings in column vector y3 in your signals file

u<ID>_lab_signals.mat. Your data were collected starting from time t = 0 at the

constant interval Ts3 in your parameter file. Please complete the following:

(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<ID>_lab.docx.

v. In no more than 5 lines of text, comment in u<ID>_lab.docx on the accuracy

of 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

10

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<ID>_lab.txt, where w4[n] is the noise signal.

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<ID>_lab_signals.mat. Please

answer the following:

(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<ID>_lab.txt).

This means that the first sample after the malfunction had a noise variance k4 times

greater than the samples before the malfunction, the second sample after the malfunction had a noise variance k42

times greater than the samples before the malfunction, and so on. Determine an appropriate weight column vector W [n] that can be

used to perform weighted least squares estimation using the entire data set. Assign

W [n] to Q4.W.

(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<ID>_lab.docx.

(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<ID>_lab.docx. You do not need to write

any code.

7 Submission of Deliverables

Place your files into a folder named u<ID>_lab (where <ID> is your student number). Zip the

folder and call it u<ID>_lab.zip. The folder should contain:

1. u<ID>_lab.m (where <ID> is your student number), containing your code.

2. u<ID>_lab_signals.mat (where <ID> is your student number), containing your assigned

signals. This file should be unchanged from the version that you downloaded.

3. u<ID>_lab_Audio.mat (where <ID> is your student number), containing your original

audio recording.

11

4. u<ID>_lab_Answers.mat (where <ID> is your student number), containing the answers

generated by your code.

5. u<ID>_lab.docx (where <ID> is your student number), containing your written answers

and all of your plot figures.

Be sure that u<ID>_lab.m runs correctly with no other custom files required.

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 Policy as 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.

8 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.

12


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp