Class 19 Thu, 2017-11-09 Power spectra, correlation (HW05)

Spectral Density
Periodogram
PSD estimation
Bartlett's method
Welch's metod of PSD estimation
Windowing: Hamming window, Nuttall window
FILE:code.gplo plotting with Perl and Gnuplot
FILE:code.psd1 simple PSD code, Perl w/Fortran and plotting all in one



Homework 05: due Tuesday, November 21, 2017 (HW05)


Note: No class on that day (pre-Thanksgiving) but HW due @COB anyways.

Start off with code.psd1 discussed in class.
  1. Extend the code to add de-trending, the Welsh method (using overlapping segements), and windowing. Specifically:

    1. Leave the subroutine 'psd' alone. Write a subtrounine BETTERPSD, that takes two more parameters: FREQMIN (the smallest desired frequency, which determines the segment length), and WINDOW, a character string that says which window to use.
    2. Although the segment overlap in the Welch method is variable, we keep it at 50 percent.
    3. The segment length should be a multiple of 16, such that FREQMIN is still satisfied. Note that the maximum frequency is always the Nyquist frequency.
    4. The windows shouls be 'RECTANGLE' (i.e., no window, really), 'HAMMING', and 'NUTTALL'.
    5. The sequence of operations is: segment --> detrend --> apply window --> call psd to get power --> add up power from all segments.
    6. For de-trending calcualte the linear regression of the data points and subtract it.
    7. Add an option to the code where the data is read from a file instead of internally generated.


  2. Applications:

    1. Calculate the PSD of the entire temperature and wind data from the UNH weather station. Play with FREQMIN and WINDOW to get clear peaks af the periods you expect (daily, yearly, etc.). Extra points for anyone who can find lunar tides! The only decent spectrum I could find is in this article: American Scientist.
    2. Use your cell phone to make a recording of you voice saying 'hi'. Draw out the 'i' a bit. You should get a 'mp3' or similar type sound file. Convert that file to an ascii readable file, for example, by using lame, and calculate the PSD.
    3. Compare your spectrum with that of at least 2 other students. Would you be able to fake someone else's spectrum? Probably not. This is forensic science.