フィルターのクリア

Hwo can i design like this ?

1 回表示 (過去 30 日間)
sara alaraby
sara alaraby 2019 年 1 月 21 日
コメント済み: Walter Roberson 2019 年 2 月 4 日
#Matlab
if i have a matrix 6*6
which gave me info about the distance between all AP
I need to make 3 groups each group consists of 2 AP where AP not repeated in each group depend on the distance
Ex: i will start from AP no. 1 if i select it with AP no.2 as the dist. between the is large
so the second step i will check the 2nd group starting from AP3 & so on
CAN ANY one hwo can i design it by matlab code
Thanks all
  6 件のコメント
sara alaraby
sara alaraby 2019 年 2 月 1 日
yes dear this is my rule
Image Analyst
Image Analyst 2019 年 2 月 3 日
sara, youi keep forgetting to attach your data, thus delaying a solution.

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2019 年 1 月 23 日
編集済み: Walter Roberson 2019 年 2 月 2 日
td = YourDistanceMatrix;
pairidx = 0;
pairs = [];
while nnz(td(:) ~= 0 & ~isnan(td(:))) >= 2
std = size(td);
[maxd, maxidx] = max(td(:));
[maxr, maxc] = ind2sub(std, maxidx);
pairidx = pairidx + 1;
pairs(pairidx, :) = [maxr, maxc];
td(maxr, maxc) = nan;
td(maxc, maxr) = nan;
end
In the above code, distance entries can be nan for forbidden connections, and distances of 0 are ignored under the assumption that they indicate a point connecting to itself (which is not always true: in theory two AP could be a the same location, and this code will refuse to pair them together even if they are the "furthest" remaining APs.)
Because of the possibility of nans and extra 0s, the number of rows output in pairs will not necessarily be the same as half of the number of access points.
  11 件のコメント
sara alaraby
sara alaraby 2019 年 2 月 4 日
dear i can't understand well what you mean
can you write such a code for me please
Walter Roberson
Walter Roberson 2019 年 2 月 4 日
td = YourDistanceMatrix;
tripidx = 0;
triples = [];
std = size(td);
while nnz(td(:) ~= 0 & ~isnan(td(:))) >= 2
[~, maxidx] = max(td(:));
[maxr, maxc] = ind2sub(std, maxidx);
td(maxr, maxc) = nan;
[~, maxc2] = max(td(maxr, :));
tripidx = tripidx + 1;
triples(tripidx, :) = [maxr, maxc, maxc2];
td([maxr maxc maxc2], :) = nan;
td(:, [maxr maxc maxc2]) = nan;
end
I doubt this is what you want, but it is what you asked for and confirmed that you wanted.
I suspect that what you want is closer to finding the set of three that together cover the greatest triangular area.

サインインしてコメントする。

その他の回答 (1 件)

sara alaraby
sara alaraby 2019 年 2 月 4 日
Dear;
yes dear i'm sure that this what i want
can you support me please
thanks

カテゴリ

Help Center および File ExchangeGenetic Algorithm についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by