% What is distance like in higher dimensions?
%% Compute distances between random vectors in R^n as n increases
% Dr. Josh Thompson, 
% Northern Michigan University


for i = 1:2000;
    u = rand(1,i); % A random vector in R^i
    v = rand(1,i); % A random vector in R^i
    d(i) = norm(u-v); % The distance between u and v
end

% Create a figure, and hold all subsequent plotting effects on same plot
figure; hold on; 
title('High Dimensional Distances Between Random Points');
xlabel('Dimension');
ylabel('Distance');
plot(d)

% Higher Dimensional Spaces are Very Large