﻿%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 cosine similary measuare. The matrix final is symmetric (i,j) = (j,i)

final=zeros(size(A,2),size(A,2));
for i=1:size(A,2);
    for j=1:size(A,2);
        final(i,j)=real(acos((A(:,i)'*A(:,j))/(norm(A(:,i))*norm(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;
