OC3150 Lab 6

1.0  Objectives:

1. Compute the Energy Density Cross-Spectra for your two field data sets:

 

(ns = number of samples)

 

2. Compute the phase difference spectra for the two data sets:

 

 

 

   

 

3. Compute coherence between the two signals:

 

 

2.0 Procedure

To find the Cross-spectrum, you'll have to find the spectral estimates, Ax1 and Ax2, for both of your data sets. Copy and modify your m-file from Lab 5 to do this.  This time detrend as well as demean your data. Use detrend(data) instead of detrend(data,'constant').

Gxy = Ax1 .* conj(Ax2) / (2*df);           % Calculate the cross-spectral density

Gxymean=mean(Gxy,2);

(Note that Gxymean also needs to be multiplied by the window correction factor at this point.) Then find the co-spectrum, Cxy, and the quad-spectrum, Qxy, using the matlab functions real and imag on the complex variable, Gxymean.  Find the phase (in degrees), using atan2(Qxy,Cxy).

 

To find the coherence you will also have to find the spectral estimates for each of your data sets. Be careful in calculating coherence to use array operators (eg `.*') not matrix operators (eg `*'). Also calculate significance level, 6/dof, to be plotted along with coherence.
 

2.1 Plotting

 

You'll want 3 plots: 1) the Spectral Density of both of your data sets on the same axes (using semilogy again), 2) the Coherence, and 3) the Phase, all versus frequency.  As in the earlier labs, use axis(v) with the appropriate values in v, so the limits of the y-axis of coherence and phase are 0 to 1, and -180 to +180 respectively. For your spectra, use the optimal values of N and NS that you determined from the five runs in Lab 5.

 

If you wish, you can copy the following m-file to your home directory and modify it appropriately so you may plot all 3 plots on one page.

 cp   ~orzech/oc3150/Lab6/lab6plt.m   ~/oc3150/lab6plt.m

You may either append this file to your lab 6 program or run it after that program has completed. Make sure you change any variable names, values, and labels that you need to for lab6plt to work correctly. (Alternatively, you are welcome to write your own code to generate the plot page using subplot. Just be careful to get the axes correct!)

 

3.0 Report

 

Answer the following questions:

  1. How do the two spectra compare with respect to frequency content and energy density levels?  Relate the results to the physical situation.
     
  2. What does the coherence tell you about the data?  the phase difference? Again, relate the results to the physical situation.
     
  3. Turn in your 3 plots and a copy of your matlab program.