how to generate random numbers in a cell of 10m by 10m with 20 nodes and assign numbers to each node

2 ビュー (過去 30 日間)
I want to reproduce exactly the attached figure. Can anyone help with codes for generating the attached figure
  1 件のコメント
Felix Obite
Felix Obite 2022 年 3 月 19 日
Its working now, size inputs must be interger values. Many thanks

サインインしてコメントする。

採用された回答

David Hill
David Hill 2022 年 3 月 19 日
SU=10*rand(20,2);%sample points example
PU=10*rand(10,2);%sample points example
scatter(SU(:,1),SU(:,2),'k*')
hold on;
text(SU(:,1),SU(:,2),[num2str((1:20)'),repmat(' ',20,1)],'HorizontalAlignment','Right')
scatter(PU(:,1),PU(:,2),'k+')
text(PU(:,1),PU(:,2),[num2str((1:10)'),repmat(' ',10,1)],'HorizontalAlignment','Right')
legend('SU','PU','Location','southwest');
ax=gca;
ax.XTick=0:10;
ax.YTick=0:10;
ax.Box='on';
  4 件のコメント

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEntering Commands についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by