How to quantify the spread/separation of points on a circle

10 vues (au cours des 30 derniers jours)
Michael
Michael le 31 Oct 2012
Hi, this may be a little vague
I have a set of points in the unit circle and I want to quantify their separation, for example, they will get a low score if they are all at the same location, and they will get a high score if they are very separated. For example, if you imagine how a set of charges would arrange themselves on a circular conducting plate, that should maximise their separation- this state would get the highest "separation" score.
Does anyone know of any algorithms or approaches I can use to do this, in the most mathematically respectable way? I really am a novice to the concept.
Thanks for any feedback, Mike

Réponses (1)

Matt J
Matt J le 31 Oct 2012
Modifié(e) : Matt J le 31 Oct 2012
If your points are the columns of a matrix A, you can quantify as
id=interdists(A);
score = sum(id(:));
where the interdist() function below generates a matrix of distances between all the points.
function Graph=interdists(A,B)
%Finds the graph of distances between point coordinates
%
% (1) Graph=interdists(A,B)
%
% in:
%
% A: matrix whose columns are coordinates of points, for example
% [[x1;y1;z1], [x2;y2;z2] ,..., [xM;yM;zM]]
% but the columns may be points in a space of any dimension, not just 3D.
%
% B: A second matrix whose columns are coordinates of points in the same
% Euclidean space. Default B=A.
%
%
% out:
%
% Graph: The MxN matrix of separation distances in l2 norm between the coordinates.
% Namely, Graph(i,j) will be the distance between A(:,i) and B(:,j).
%
%
% (2) interdists(A,'noself') is the same as interdists(A), except the output
% diagonals will be NaN instead of zero. Hence, for example, operations
% like min(interdists(A,'noself')) will ignore self-distances.
%
noself=false;
if nargin<2
B=A;
elseif ischar(B)&&strcmpi(B,'noself')
noself=true;
B=A;
end
N=size(A,1);
B=reshape(B,N,1,[]);
tmp=bsxfun(@minus, A, B);
Graph=sqrt(dot(tmp,tmp,1));
Graph=squeeze(Graph);
if noself
n=length(Graph);
Graph(linspace(1,n^2,n))=nan;
end

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by