Reference no: EM134581
Exercise 1
In this exercise we will explore the discrete Fourier transform (DFT) and the fast Fourier transform (FFT).
(a) Compute the DFT matrix F for a signal that has 59 elements.
(b) Use this DFT matrix to compute the vector of frequencies ^ x = Fx corresponding to a measurement vector x given by the rst 59 odd numbers.
(c) Use the FFT command to compute the same vector of frequencies.
Exercise 2
Now, we will use the FFT to simultaneously compress and re-master an audio le.
(a) Listen to the audio signal (>>sound(rush,FS);). Compute the FFT of this audio signal.
(b) Compute the power spectral density vector. Plot this to see what the output looks like.
(c) Plot the spectrogram using the same parameters as in lecture. Don't save any les.
(d) Now, download r2112noisy.m and run this script to initialize the variable rushnoisy. This signal is corrupted with high-frequency artifacts. Manually zero the last 3/4 of the Fourier components of this noisy signal (if n=length(rushnoisy), then zero out all Fourier coefcients from n/4:n). Use this ltered frequency spectrum to reconstruct the clean audio signal. When reconstructing, be sure to take the real part of the inverse Fourier transform:
cleansignal=real(ifft(filteredcoefs));.
Because we are only keeping the rst 1/4 of the frequency data, you must multiply the reconstructed signal by 2 so that it has the correct normalized power. Be sure to use the sound command to listen to the pre- and post-ltered versions. If you are interested, look at the power spectral density and spectrograms of the pre- and post-ltered signals.
Exercise 3-In this exercise you will be using fminsearch and function handles to nd the minimum value of a function called myfunc(x,a,b) with respect to the variable x. Download, but do not upload, the le myfunc.m from the course website. There is another, dierent version of myfunc.m that your code will interact with on compsoftbook; it has the same inputs and outputs.
(a) For a=1 and b=2, evaluate the function for x values from 1 to 2 in increments of 0:1.
(b) Use fminsearch to nd the x value that minimizes the function for a=3 and b=-3. Use an initial guess of x=0. Also evaluate the function at this x. ANSWERS: Save these two values as a row vector in A8.dat.