$30
Prepare a report (pdf file) that includes your code, explanations, and comments of your code for each question. You will compress everything into a zip file. Name it as YourNumber-CmpE362HW1.zip and submit it via Moodle.
The Moodle upload limit is 2MB, do not forget to shrink your report pdf before submission. I will not accept any e-mail submissions. When copying is detected, both parties will get zero.
1 Question 1 - Fourier Series
Figure 1: Wave
1.1 Part A (30)
First, you have to find Fourier series coefficients for the given periodic signal x(t) in figure 1 (x(t) = 0.2t for − 5 < t < 5). Please write on a piece of paper clearly without skipping any steps.
You can include the photo of the paper in your report. (Your answer should be handwritten, and it should include your name and sign.)
Please write the values for ak when k is 0, even, and odd and draw the magnitude and phase spectrum of the signal w.r.t. frequency (Hz). Compare your results using fseriesdemo library instead of fft script because of nonidealities. Link: https://dspfirst.gatech.edu/matlab/
1.2 Part B (15)
Construct the original signal in figure 1 using MATLAB. You can use the built-in sawtooth function with the following lines. fs = 100;
t = -10:1/fs:10-1/fs; x = sawtooth(2*pi*0.1*t+pi);
Figure 2: Harmonic Summation
Reproduce the Fig. 2 in MATLAB and add it to your report. Explain your code briefly in your report as well.
Please solve Part B in a single script (question1.m) and include it in your submission.
2 Question 2 - Faulty Phone (25)
There is a sound file named ’faultyphone.wav’ on Moodle. This file is obtained by adding the sound of the la-note on top of a voice recording. Your assignment is to recover the voice recording by designing an ideal band-pass/reject filter that means your filter will make the power of the signal for certain frequencies 0, and it will not affect the signal for other frequencies. Notes: You can use ’audioread’ and ’audiowrite’ to read and generate sound files. There is a duality between time domain and frequency domain. You should remember that we use the convolution operation to apply our filter in time domain. The multiplication operation in frequency domain is equivalent to the convolution operation in time domain. We move from time domain to frequency domain using ’fft’ and ’fftshift’, and we move from frequency domain to time domain using ’ifft’ and ’ifftshift’.
In your report, briefly explain your code, include a plot of your signal w.r.t. frequency before and after the filter operation, and comment on the success of recovery. Send me your script (question2.m) and the recovered audio file.
3 Question 3- Averaging filter and RPM calculation (30)
In this question, you will use another sound file ’enginesound.m4a’ to try an averaging filter and to calculate the RPM of an engine.
Download the sound file and implement a 50-point average time filter. Apply your filter in time domain. Generate the resulting sound signal and compare it with the original sound in your report. You may increase the amplitude of the resulting signal to make a fair comparison if the volume is suppressed. (For example, you can comment on noise.)
To calculate the RPM of the engine, we use the following formula:
60 [RPM]
f0
2 cylinder 1 [Hz]
Nstroke and Ncylinder are both 4 for this engine. f0 is the fundamental frequency, and we assume that it will reveal itself with a big amplitude at a low frequency in spectrum analysis. Use spectrogram to determine the fundamental frequency and calculate the NRPM. (You can check your guess with fft script but you are asked to use spectrogram in this question.) In your report, briefly explain your code, comment on your averaging filter, and include your spectrogram plot (zoomed into f0) and your calculations for RPM. Send me your script (question3.m) as well.