Clear Filters
Clear Filters

3D plot of two point correlation distribution

3 views (last 30 days)
I currently have a running program that plots the distances of one set of 100 points to another different set of 100 points (so I have 10000 distances in total). This is for a specific r value I specify in my code directly. I want to add another dimension to this code where as r increases, the distances between these points vary as well.
Currently my code is:
% get random data galaxies1 = rand(100,3)*100 ; galaxies2 = rand(100,3)*100 ; % calculate GALARRAY = nan(length(galaxies1), length(galaxies2)); phi = 0; phiNot = 0; r = 1; count = 0; delt = rand(10,1)*10000.e+0;
for i = 1:(length(galaxies1)) for j = 1:(length(galaxies2)) GALARRAY(i,j) = sum((galaxies1(i,:) - galaxies2(j,:)).^2); count = count + 1; display(count) if all((r <= GALARRAY(i,j)) & (GALARRAY(i,j) <= (r + delt))) %all phi = phi + 1; display(phi) else phiNot = phiNot + 1; end end end summation_total = phi - phiNot; display(summation_total); display(phi); display(phiNot);
% plot the Galaxies distances imagesc(GALARRAY) ylabel('Set 1') xlabel('Set 2') HC = colorbar; ylabel(HC,'distance')

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!