フィルターのクリア

set the threshold value by percentage

7 ビュー (過去 30 日間)
muhammad faiz
muhammad faiz 2017 年 2 月 22 日
コメント済み: Jan 2017 年 2 月 23 日
Hi, if i have 2 matrices A and B. A=rand(1,2) B=rand(10,2)
how do i find a point B where the distance to points A is closest, and i do not what the min value (distances). i would like to find something like "find distances that is higher 30 percent than the min value of the distances". please, how to do just that?
thank you.

回答 (1 件)

Jan
Jan 2017 年 2 月 22 日
編集済み: Jan 2017 年 2 月 22 日
Start with finding the distances:
A = rand(1,2);
B = rand(10,2);
Dist = sqrt(sum((A - B).^2, 2));
Then determine the minimum and add 30%:
searched = min(Dist) * 1.3;
Now search the distance, which is nearest to searched:
[~, Index] = min(abs(Dist - searched));
Finally Index is the row of B, which is nearest to 130% of the minimum distance.
  2 件のコメント
muhammad faiz
muhammad faiz 2017 年 2 月 22 日
hai, thanks for the helps, but may i know, why there is no change in Index value when i change the percentage to maybe 1.4 or 1.5? however, when i change to higher value (e.g 1.8 or 2.0), the Index is changed.
Jan
Jan 2017 年 2 月 23 日
This depends on the data. If the value, which is nearest to 130% is the nearest to 150% also, you get the same index. The smaller B is, the higher is the chance to get the same result for e.g. 130% and 140%. Try it with B = rand(1000, 2).

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

カテゴリ

Help Center および File ExchangeOperators and Elementary Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by