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

1 次查看(过去 30 天)
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 个评论

请先登录,再进行评论。

更多回答(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