2013-12-10 12 views
-3

나는 사용자의 위치, 액세스 포인트 및 기지국포인트 간 거리를 계산하는 방법은 무엇입니까?

figure('Color', 'white') 
UserLocationX = randi(50, 1, 50); 
UserLocationY = randi(50, 1, 50); 
plot(UserLocationX, UserLocationY, '^-', 'MarkerSize', 5, 'LineWidth', 2), hold on  
AccessPointX = randi(50, 1, 8); 
AccessPointY = randi(50, 1, 8); 
plot(AccessPointX, AccessPointY, 'go', 'MarkerSize', 5, 'LineWidth', 6), hold on 
BaseStationX = 25; 
BaseStationY = 25; 
plot(BaseStationX, BaseStationY, 'rs', 'MarkerSize', 5, 'LineWidth', 6), hold on, grid on 
leg = legend('User Location', 'Access Point', 'Base Station'); 
set(leg, 'Location', 'NorthEastOutside') 
xlabel('x-candidate') 
ylabel('y-candidate') 
title('Scenario') 
+0

사용자와 BS 사이, BS와 AP 사이, 사용자와 AP 사이? –

+0

사용자와 학사 간, 사용자와 AP – user3087700

+3

제목이 바뀌 었습니다. "Matlab 코드를 작성하는 방법"은 매우 광범위했습니다.) – thewaywewalk

답변

0

사용 pdist2 사이의 거리를 계산합니다.

pdist2([AccessPointX(:) AccessPointY(:)],[UserLocationX(:) UserLocationY(:)]) 

다른 경우가 유사하다 : AP와 사용자 사이

.

+1

그림에 거리가 표시되지 않았습니다. – user3087700

+0

이것은 귀하의 질문에 대한 답변입니다 ("거리를 계산하는"). 이것이 당신이 원하는 것이 아니라면, 나는 당신의 질문을 수정하는 것이 좋습니다. – Daniel

관련 문제