% A simple example to show that ``the contribution
% of leading components to reproduce the data'' 

% hours, scores 
A = [
9  39
15 56
25 93
14 61
10 50
18 75
0  32
16 85
5  42
19 70
16 66
20 80 
];

% SVD 
[U,S,V]=svd(A,0); 
sigma = diag(S);

% the leading component
size = sigma(1)*U(:,1);  
hour_pca= size*V(1,1)  
score_pca = size*V(2,1)  

figure(1)
subplot(2,1,1)
bar([A(:,1) hour_pca])
title('Hours') 
subplot(2,1,2)
bar([A(:,2) score_pca])
title('Scores') 
