clear all;
close all;

%Initialize covariance matrix
S = [5 4; 4 5];

%Load data
load('points');
%Show correlation of original points
corrcoef(X)

%Compute eigenvectors and eigenvalues
[V D] = eig(S); 
D
V

%Project data
pX = (V * X')';

%Show correlation of projected points
corrcoef(pX)

%Showing data
figure;
subplot(121)
scatter(X(:,1),X(:,2),'filled');
axis equal
xlabel('x');
ylabel('y');
title('Original Data');

subplot(122);
scatter(pX(:,1),pX(:,2),'filled');
axis equal
xlabel('x');
ylabel('y');
title('Projected Data');
