Comparing vector elements by percentage
4 ビュー (過去 30 日間)
古いコメントを表示
Angle=[5 10 20 60 180 190 195 300 310], these angles determine the possible directions of robots. If there are 2 robots starting with the same angle or plus minus 5%(5 degrees) they will make collision. I'd like to have the result in on vector such that:[2 2 1 1 1 2 2 1 1]. Any help?
5 件のコメント
Stefan Raab
2015 年 11 月 2 日
編集済み: Stefan Raab
2015 年 11 月 2 日
Hello,
the codeline
collision(i)= Angle(inToleranceIndexes)
won't work, if inToleranceIndexes has more than one value==1. Then Angle(inToleranceIndexes) i.e. is [300 310] and you can't assign a vector to a single element as you do with collision(i).
But a question in general: You say tolerance is 0.05*targetValue, that means your tolerance increases with increasing start-angle. Is this really how it is supposed to be?
Best regards, Stefan
回答 (1 件)
Image Analyst
2015 年 11 月 2 日
As mentioned in your duplicate question there will be no collision unless you have different starting points. And all your code does is tell you that each angle interferes/collides with no other angle except itself, which is pretty useless.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Resizing and Reshaping Matrices についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!