0% found this document useful (0 votes)
11 views2 pages

2024 Fall Computer Assignment 2

Uploaded by

amyamy5198
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

2024 Fall Computer Assignment 2

Uploaded by

amyamy5198
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

11310ESS 328000 Signals and Systems

Computer Assignment 2
Due: 15:00, November 19th (Tuesday), 2024

Please turn in your work to eeclass by 15:00. Late submission will receive no credit.

Your submission should obey the following rules:


 Keep your code neat and readable.
 For each problem, the corresponding MATLAB file(.m file) is needed, with the file name
“CAx_problemNum.m”. Ex: CA2_1.m
 An answer sheet to show your results(.pdf file), with the file name “CAx_report.pdf”.
 Put your codes and report in a folder and zip it with the name ”StudentID_CAx”.
Ex: 110010016_CA2.rar or 110010016_CA2.zip
 If you used generative AI in your assignment, please specify which parts were generated, and add
brief comments explaining what you learned from these sections, such as: what this function does
or what this syntax represents.

Write your MATLAB scripts for the following problems.

1. (25%) Let

cos ( 0.1 n ) + sin ( 0.1 n ) , 0  n  200


x[n] = 
 0, otherwise

( − 2) n , 0  n  3
h[n] = 
 0, otherwise

(a) Write your own convolution function to compute y[n] = x[n]  h[n] and plot the result. Please create
a new function file named “my_conv” to do this work. (15%)
(b) Repeat previous problem by using AI tools, e.g. ChatGPT. Compare the result with your own
convolution function. For example, time consuming, syntax, and so on. (5%)
(c) Use MATLAB built-in function conv() to compute and plot y[n] again. (5%)
2. (35%) Given a square wave S ( t ) in the following figure, the Fourier series representation for the

square wave is
N
4 1
f (t ) = 
 n =1,3,5,... n
sin ( n t )

Hint
% square wave
t = linspace(0,2*pi,500)';
y = square(t);

t_approx = 0:0.01:2;
square_approx = … (your code)

plot(t/pi,y,'k--','LineWidth',3);
% hold on
% plot(t_approx, square_approx)
% hold off

Where N is the total number of Fourier coefficients used for approximation.

Please compare the approximated square wave f ( t ) with S ( t ) using N = 1, 5, 9, 15 in a 2-by-2

subplot, and discuss your results. [Hint: you can set t_approx = 0:0.01:2, and overlap f ( t ) with the figure

by using hold on function.]

3. (40%) When we dial a telephone number, a dual-tone multi-frequency signaling pitch consisting of two
simultaneous pure tone sinusoidal frequencies will be produced once a single key is pressed. For
example, pressing the key '1' will result in a sound composed of both a 697 and a 1209Hz tone.

(a) Please load the audio file ‘PhoneSound.wav’ and plot the audio signal x .
[Hint: you can use the build-in function audioread, in which you can get the sampling rate f s and
audio signal x . The sampling rate indicates the number of samples taken per second. The audio
signal is composed of 10 telephone button tones.] (10%)
(b) Please divide x into 10 segments having equal length (0.5 sec), and plot the power spectral density
for each segment. [Hint: you can use MATLAB built-in function fft().] (25%)
(c) From each plot, you will find two pitches and please tell what number was dialed based on the definitions
provided in the above table. Please answer what phone number was dialed? (5%)

You might also like