ts = load('tseries12.txt');

ts0 = ts(1,:);
ts1 = ts(2,:);

NFFT = 256;
Fs = 1.0/1;
noverlap = NFFT/2;

window = hanning(NFFT);
%[fxx, f] = csd(ts0, ts1, NFFT, Fs, window, noverlap, 'mean');
%fxx = real(fxx);

[fxx2, f] = cpsd(ts0, ts0, window, noverlap, NFFT, Fs); 
fxx2 = real(fxx2);

%save('fxx_matlab.txt','fxx','-ascii');
save('fxx_matlab.txt','fxx2','-ascii');
