필터 지우기
필터 지우기

how can i calculate the minimum distance between user location and access point?

조회 수: 1 (최근 30일)
in this code
figure('Color', 'white')
dis = zeros(50,8);
UserLocationX = randi(50, 1, 50);
UserLocationY = randi(50, 1, 50);
AccessPointX = randi(50, 1, 8);
AccessPointY = randi(50, 1, 8);
for k=1:50
for l=1:8
dis (k,l)= sqrt((UserLocationX(k)-AccessPointX(l)).^2 + (UserLocationY(k)-AccessPointY(l)).^2);
end
end
plot(dis,'d'), grid on
xlabel('x1')
ylabel('y1')
title('distances between UL and AP')

채택된 답변

Star Strider
Star Strider 2014년 5월 18일
This will calculate the minimum distance from each user to an access point. The C is the distance for that particular user (row number in this instance), and I is the index of that distance (column number), corresponding to the number of the access point:
[C,I] = min(dis,[],2)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Fluid Network Interfaces Library에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by