% just a little question ....

disp('LFD1 tutorial question week 2')

% 
% this is a 2
x(1,:)=[0 1 1 1 0];
x(2,:)=[1 0 0 0 1];
x(3,:)=[0 0 1 1 0];
x(4,:)=[0 1 0 0 0];
x(5,:)=[1 1 1 1 1];

% this is another 2
y(1,:)=[1 1 1 0 0];
y(2,:)=[0 0 0 1 0];
y(3,:)=[0 0 1 0 0];
y(4,:)=[0 1 0 0 0];
y(5,:)=[1 1 1 1 0];

% this is a 3
z(1,:)=[1 1 1 1 0];
z(2,:)=[0 0 0 1 0];
z(3,:)=[0 0 1 0 0];
z(4,:)=[0 0 0 1 0];
z(5,:)=[1 1 1 1 0];

% you can visualise these using e.g.

figure(1); imagesc(x); colormap('gray');

% QUESTION :
% By converting x y and z to a vector representation :
%
% calculate the distance between x and y 
% calculate the distance between y and z 
% calculate the distance between x and z 
% calculate the angle between x and y 
% calculate the angle between y and z 
% calculate the angle between x and z 


e = eye(5); rp = e(:,[5 1 4 3 2]);
xx = x*rp; yy = y*rp; yy = y*rp;

% QUESTION :
% Visualise (using three figures) the new data xx, and yy, and zz.
%
% By converting xx yy and zz to a vector representation :
% calculate the distance between xx and yy 
% calculate the distance between yy and zz 
% calculate the distance between xx and zz 
% calculate the angle between xx and yy 
% calculate the angle between yy and zz 
% calculate the angle between xx and zz 
% calculate the distance between xx and x
%
% Comment on your results.
% Please produce a printout of your calculations -- you can do this by
% clicking on the `print' option under `file' in the MATLAB toolbar.


A(1,:)=[1 2];
A(2,:)=[0.1 -1];
A(3,:)=[0.7 0.4];

d = A*randn(2,100);
figure; plot3(d(1,:),d(2,:),d(3,:),'.')
rotate3d

% QUESTION :
% Consider the data matrix d (defined above) which contains 100
% datapoints in a 3 dimensional space.
% Although the data is three dimensional, what do you think the
% `intrinsic' dimension of the data is?
% Hint : click on the figure to rotate the image.
