Assignment #4


For this assignment you will be doing fits to data as well as analysis of some data to find frequencies in it. There is a different data file for each of the different parts of the assignment that you can download. These files are in Matlab native format so simply use the load command to read them in. What you will submit to me is a script m-file and possibly function m-files. The script m-file should be commented to show me which problem you are working on and what answer you found.

1. Read in this file and do the following analysis on the arrays x and y that it holds. (After loading a file you can always use whos to see that variables you have defined in Matlab.) Do polynomial fits to the data with ploymonials that have order 1, 2, and 7. Put lines in the script that will overplot the data with dots ('o' in the plot command) and the three polynomials with lines (that's the default). Lastly, evaluate the derivative of the three polynomials at the middle x value. Is there anything you notice about the polynomials or their derivatives?

2. Read in this file and do the following analysis on the arrays x and y that it holds. For this I want you to do something similar to the second problem on the last quiz. You are going to do a fit for an exponential rate. If you plot y vs. x you will see this data drops with time. Write the code the tell me the timescale over which it gets cut in half.

3. Lastly, read in this file and do some Fourier analysis on it. The file contains arrays t and v. I want you to tell me the three primary frequencies that are present in the data. Do do this, you will do an fft on v. Because the t array goes from 0 to 2*pi, the index in the fft output corresponds to a constant in the sin or cosine function. For example, if there was a maximum at the 5th index of abs(fft(v)), then it would tell you that there was a strong signal from cos(5*t) or sin(5*t). Had I picked a different range for t those values would need to be scaled up or down. The magnitudes of the peaks also tell you something of the relative magnitudes of the frequencies. Tell me which of the three main components is strongest and which is weakest.