Documentation of compare_coup_stoc


Global Index (short | long) | Local contents | Local Index (short | long)


Cross-Reference Information

This script calls

Listing of script compare_coup_stoc


clean
cd /home/disk/hayes2/dvimont/ocean/coup/coup
load h_lph_thinned_coup.mat;
hc = h; hc2 = h2; cthc = cth; cthc2 = cth2;
load h_lph_thinned_stoc.mat
figure(1); fo(1); clf;
subplot(4,2,1);
  tem = cthc(1:1200);
  nfft = 256; nover = nfft/2; n2 = nfft/2;
  [p,f] = spectrum(tem, nfft, nover);
  rho = (corr(tem, tem, 1)+sqrt(corr(tem, tem, 2))+...
	 corr(tem, tem, 3)^(1/3))/3;
  rn = (1-rho^2) ./ (1-2*rho*cos((pi/n2)*(0:n2))+rho^2);
  rn = rn / mean(rn(3:(n2+1)));
  rn = rn * mean(p(3:(n2+1),1));
  rner1 = rn * 1.7; rner5 = rn * 2.5;
  dofx = length(tem) / n2;
  xt = [128 64 32 16 8 4 2 1 0.5 0.25];
  f2 = f.*6;
  hh = loglog(f2, p(:,1), '-k', f2, rn', '-k', ...
	      f2, rner5', '--k', f2, rner1', '-.k');
  set(hh(1), 'linewidth', 2);
  axis([1/20 6.5 1e3 1e8]);
  set(gca, 'XTick', 1./xt, 'XTickLabel', xt);
  set(gca, 'YTick', 10.^[1:10]);
  hold on;
    hline(10.^[1:10], ':k');
    vline(1./xt, ':k');
  hold off;
  title('Coupled Run');
subplot(4,2,2);
  tem = cth(1:1200);
  nfft = 256; nover = nfft/2; n2 = nfft/2;
  [p,f] = spectrum(tem, nfft, nover);
  rho = (corr(tem, tem, 1)+sqrt(corr(tem, tem, 2))+...
	 corr(tem, tem, 3)^(1/3))/3;
  rns = (1-rho^2) ./ (1-2*rho*cos((pi/n2)*(0:n2))+rho^2);
  rns = rns / mean(rns(3:(n2+1)));
  rns = rns * mean(p(3:(n2+1),1));
  rner1s = rns * 1.7; rner5s = rns * 2.5;
  dofx = length(tem) / n2;
  xt = [128 64 32 16 8 4 2 1 0.5 0.25];
  f2 = f.*6;
  hh = loglog(f2, p(:,1), '-k', f2, rns', '-k', ...
	      f2, rner5s', '--k', f2, rner1s', '-.k');
  set(hh(1), 'linewidth', 2);
  axis([1/20 6.5 1e3 1e8]);
  set(gca, 'XTick', 1./xt, 'XTickLabel', xt);
  set(gca, 'YTick', 10.^[1:10]);
  hold on;
    hline(10.^[1:10], ':k');
    vline(1./xt, ':k');
  hold off;
  title('Uncoupled Run');
subplot(4,2,3);
  nfft = 256; nover = nfft/2; n2 = nfft/2;
  tem = cthc(1:1200);
  [p1,f] = spectrum(tem, nfft, nover);
  tem = cth(1:1200);
  [p2,f] = spectrum(tem, nfft, nover);
  f2 = f.*6;
  hh = loglog(f2, p1(:,1), '-k', f2, p2(:,1), '--k');
  set(hh, 'linewidth', 2);
  axis([1/20 6.5 1e3 1e8]);
  set(gca, 'XTick', 1./xt, 'XTickLabel', xt);
  set(gca, 'YTick', 10.^[1:10]);
  hold on;
    hline(10.^[1:10], ':k');
    vline(1./xt, ':k');
  hold off;
  title('Both');
subplot(4,2,4);
  hh = semilogx(f2, p1(:,1)./p2(:,1), 'k');
  set(hh, 'linewidth', 2);
  axis([1/20 6.5 -1 21]);
  set(gca, 'XTick', 1./xt, 'XTickLabel', xt);
  set(gca, 'YTick', 0:5:20);
  hold on;
    hline([0:5:20], ':k');
    vline(1./xt, ':k');
  hold off;
  title('Ratio:  Coup/Uncoup');
[p, f] = spectrum(cth, cthc, nfft, nover);
subplot(4,2,5);
  hh = semilogx(f2, p(:,5), 'k');
  set(hh, 'linewidth', 2);
  axis([1/20 6.5 -0.1 1.1]);
  set(gca, 'XTick', 1./xt, 'XTickLabel', xt);
  set(gca, 'YTick', 0:.25:1);
  grid on
  title('Coherence (Coup and Uncoup)');
  xlabel('\phi < 0 \Rightarrow Uncoup leads Coup')
phs = atan2(imag(p(:,3)), real(p(:,3)));
kp = find(1./f2 > 1.5);
x = f2(kp);
y = phs(kp);
x = x - mean(x);
y = y - mean(y);
tau = x'*y./(x'*x);
subplot(4,2,6);
  hh = semilogx(f2, 180/pi*phs, 'k', f2, 180/pi*tau*f2, '-k');
  set(hh(1), 'linewidth', 2);
  axis([1/20 6.5 -95 95]);
  set(gca, 'XTick', 1./xt, 'XTickLabel', xt);
  set(gca, 'YTick', -180:45:180);
  grid on
  title('Phase (\phi)');  
  xlabel('\phi < 0 \Rightarrow Uncoup leads Coup')
  legend(hh, 'Phase', 'Best Fit Tau = -1.38');
cd ~/matlab/Ocean/Figs
print -dps2 time_series_compare.ps