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

% height, weight 
A = [
47 15
93 35
53 15
45 10
67 27
42 10
]

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

% reconstructed data matrix A by using the leading component. 
height_pca = sigma(1)*U(:,1)*V(1,1)  
weight_pca = sigma(1)*U(:,1)*V(2,1)  


figure(1)

subplot(2,1,1)
bar([A(:,1) height_pca])
title('Height') 

subplot(2,1,2)
bar([A(:,2) weight_pca])
title('Weight') 
