필터 지우기
필터 지우기

Even distribution of coordinates subset

조회 수: 3 (최근 30일)
Giovanni Barbarossa
Giovanni Barbarossa 2020년 12월 5일
댓글: David Goodmanson 2020년 12월 16일
I have two sets of coordinates A and B, where B is an arbitrary subset of A.
I would like a measure of how evenly B is distributed along the x coordinate of A.
I have attached an example of A, and three examples of B, called B1, B2, and B3, where B1 is the “best” and B3 the “worst” from an even distribution along the x axis standpoint.
Thank you!

채택된 답변

David Goodmanson
David Goodmanson 2020년 12월 6일
편집: David Goodmanson 2020년 12월 6일
Hi Giovanni,
here is one method, which assumes that B is supposed to span basically the entire domain of A.
Suppose the set of coordinates xa runs from Ainit to Afin, and that the row vector of coordinates B has N points, which are sorted.
w = (Afin - Ainit)/N;
xb1 = [Ainit-w/2 xb Afin+w/2];
E = sum((diff(xb1)-w).^2)
In this model the set of N points divides the interval from Ainit to Afin into N+1 intervals. E is the energy of springs of unstretched length w between each of the interior intervals (there are some details to take care of at the ends). The best set B is the one that minimizes E.
The ideal set of point spacings of xb is [ w/2, w, w, w ... w/2 ]. Other variations, that treat the end points differently, are possible.
  댓글 수: 4
Giovanni Barbarossa
Giovanni Barbarossa 2020년 12월 15일
Thanks David. That should work. I will experiment and figure it out.
David Goodmanson
David Goodmanson 2020년 12월 16일
If you have the time I would be interested to know how it turns out.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics and Visualization에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by