필터 지우기
필터 지우기

How to plot a line between the corresponding point on the x y palne?

조회 수: 1 (최근 30일)
hadi
hadi 2015년 11월 27일
댓글: Star Strider 2015년 11월 27일
Hi All,
I have the first set of points that are defined as follows:
N=5;
Xmax=200;
Ymax=200;
AP_X=Xmax*rand(1,N);%APs random X possitions in meters.
AP_Y=Ymax*rand(1,N);%APs random Y possitions in meters.
And I have the other set of points that are defined as follows:
AU_X=Xmax*rand(1,N);%Users random X possitions in meters.
AU_Y=Ymax*rand(1,N);%Users random Y possitions in meters.
Now, I want to draw a line between the corresponding points from the two sets (i.e. point1 with point1, point2 with point2, and so on)
Thank you.

채택된 답변

Star Strider
Star Strider 2015년 11월 27일
편집: Star Strider 2015년 11월 27일
If I understand correctly what you are asking, this will work:
N=5;
Xmax=200;
Ymax=200;
AP_X=Xmax*rand(1,N);%APs random X possitions in meters.
AP_Y=Ymax*rand(1,N);%APs random Y possitions in meters.
AU_X=Xmax*rand(1,N);%Users random X possitions in meters.
AU_Y=Ymax*rand(1,N);%Users random Y possitions in meters.
figure(1)
plot([AP_X; AP_Y], [AU_X; AU_Y], '-k')
hold on
plot(AP_X, AU_X, 'bp')
plot(AP_Y, AU_Y, 'r^')
hold off
EDIT — Replaced original code with code matching ‘fig.jpg’ in hadi’s first Comment.
  댓글 수: 4
hadi
hadi 2015년 11월 27일
Thank You very much. Hope you the best.
Star Strider
Star Strider 2015년 11월 27일
My pleasure, as always.
You, too!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by