clear all
close all

load foo.ot

# Using correlation function
corr (x, y) - 1

# Using definition implemented by scratch
x_n = x - mean (x);
y_n = y - mean (y);
corr_1 = x_n.' * y_n / sqrt (x_n.' * x_n * y_n.' * y_n);
corr_1 - 1

# Using logarithm
log_corr = log (x_n.' * y_n) - 0.5 * (log (x_n.' * x_n) + log (y_n.' * y_n));
corr_2 = exp (log_corr);
corr_2 - 1
