﻿%matrix A is the matrix with user ratings
%The (i,j) entry of the matrix final is user vector i compared with user vector
%j, using the distance (Euclidean) norm. The matrix final is symmetric (i,j) = (j,i)

%build an empty square matrix whose number of rows and columns is the number
%of columns of original matrix, A
final=zeros(size(A,2),size(A,2));
for i=1:size(A,2);
    for j=1:size(A,2);
        final(i,j)=norm(A(:,i)-A(:,j));
    end
end

%the following lines declares the colormap, for more 
%options type help colormap in the Command Window
colormap('rainbow');


%create heatmap using colormap above
imagesc(final);

%insert colorbar next to heatmap
colorbar;