source ("config/plot-setup.m");
observed = [10 19; 11 21; 12 20; 14 25; 15 26; 17 28];
center = mean (observed, 1); [direction, variance] = eig (cov(observed));
angle = linspace (0, 2*pi, 181);
ellipse = center.' + 2.*direction*sqrt(variance)*[cos(angle); sin(angle)];
figure (1); plot (observed(:,1), observed(:,2), "o"); hold on;
plot (ellipse(1,:), ellipse(2,:), "-");
xlabel ("Sensor A reading (C)"); ylabel ("Sensor B reading (C)");
title ("A two-standard-deviation covariance ellipse"); grid on; axis padded;
printf ("Covariance eigenvalue sum: %.6f\n", trace(variance));
print (gcf, "figures/OCT-17-005.pdf", "-dpdfcairo");
close all;
