Use MATLAB to generate N128 evenly spaced points t between 0
Use MATLAB to generate N=128 evenly spaced points t between 0 and 2 and evaluate the function f(t) = cos(41*t)+sin(15*t). Add a random component to this function using the function randn. Use fft to generate a DFT of these values.
(a) Plot the function f(t) before and after adding the random component, to make sure you are truly randomizing it. You should notice that the periodicity is not apparent anymore in the randomized version. However the power spectrum approach below will detect periodicity in the signal even if it is not obvious in the time domain.
(b) Plot the power spectrum for the first 64 coefficients (i.e. the positive frequency spectrum). In the plot, assign values 0:63 to the x-axis.
(c) Now plot the full Power spectrum. In the plot, assign values 0:127 to the x-axis. Mark the Nyquist frequency in the plot (can be drawn by hand and embedded as a photo/scan or indicated using your Word processor below the plot). (d) Now use fftshift to create a plot of the full spectrum centered at zero. In the plot, assign values -64:63 to the x-axis.
Solution
Add some random noise with a standard deviation of 2 to produce a noisy signal y. Take a look at this noisy signal y by plotting it.
Finding the discrete Fourier transform of the noisy signal y; just take the fast-Fourier transform (FFT).
Compute the power spectral density, a measurement of the energy at various frequencies, using the complex conjugate. Form a frequency axis for the first 127 points and use it to plot the result. (The remainder of the points are symmetric.)
