how to generate random numbers in a cell of 10m by 10m with 20 nodes and assign numbers to each node
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Felix Obite
am 19 Mär. 2022
Kommentiert: Felix Obite
am 19 Mär. 2022
I want to reproduce exactly the attached figure. Can anyone help with codes for generating the attached figure
Akzeptierte Antwort
David Hill
am 19 Mär. 2022
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 Kommentare
David Hill
am 19 Mär. 2022
I copied and pasted it into the command line and it runs without error. What version of MATLAB are you using?
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!